Skip to content

Class NbtJsonSerializer

Namespace: Void.Minecraft.Nbt.Serializers.Json
Assembly: Void.Minecraft.dll

Serializes NBT tags as natural JSON values and infers tag types while deserializing.

public static class NbtJsonSerializer

Inheritance

objectNbtJsonSerializer

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Fields

Options

Gets the shared mutable serializer options containing all NBT and UUID converters.

public static readonly JsonSerializerOptions Options

Field Value

JsonSerializerOptions

Methods

Deserialize(string)

Deserializes JSON text, falling back to an NBT string when the input is not valid JSON.

public static NbtTag Deserialize(string value)

Parameters

value string

The JSON text or literal string value.

Returns

NbtTag

The inferred NBT tag.

Deserialize(JsonNode)

Deserializes a JSON node to an inferred NBT tag.

public static NbtTag Deserialize(JsonNode node)

Parameters

node JsonNode

The JSON node.

Returns

NbtTag

The inferred NBT tag.

Exceptions

JsonException

No tag can be deserialized from the node.

Serialize(NbtTag)

Serializes an NBT tag to a JSON node.

public static JsonNode Serialize(NbtTag tag)

Parameters

tag NbtTag

The tag to serialize.

Returns

JsonNode

The JSON representation.

Exceptions

JsonException

Serialization produces no JSON node.