Class NbtListJsonConverter
Namespace: Void.Minecraft.Nbt.Serializers.Json.Tags
Assembly: Void.Minecraft.dll
Converts between NBT lists and JSON arrays.
public class NbtListJsonConverter : JsonConverter<NbtList>Inheritance
object ← JsonConverter ← JsonConverter<NbtList> ← NbtListJsonConverter
Inherited Members
JsonConverter<NbtList>.CanConvert(Type), JsonConverter<NbtList>.Read(ref Utf8JsonReader, Type, JsonSerializerOptions), JsonConverter<NbtList>.ReadAsPropertyName(ref Utf8JsonReader, Type, JsonSerializerOptions), JsonConverter<NbtList>.Write(Utf8JsonWriter, NbtList, JsonSerializerOptions), JsonConverter<NbtList>.WriteAsPropertyName(Utf8JsonWriter, NbtList, JsonSerializerOptions), JsonConverter<NbtList>.HandleNull, JsonConverter<NbtList>.Type, JsonConverter.CanConvert(Type), JsonConverter.Type, object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
Numeric elements are widened to a common NBT numeric type during deserialization. An array whose elements have different types becomes a list of compounds, with each element that isn’t a compound under an empty key, as Minecraft writes such lists since 1.20.3, so a text component’s arguments can mix strings and components. As in Minecraft, serialization writes any compound that holds only an empty key as its value, even in a list that held only compounds.
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type
public override NbtList Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)Parameters
reader Utf8JsonReader
The reader.
typeToConvert Type
The type to convert.
options JsonSerializerOptions
An object that specifies serialization options to use.
Returns
The converted value.
Write(Utf8JsonWriter, NbtList, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, NbtList tag, JsonSerializerOptions options)Parameters
writer Utf8JsonWriter
The writer to write to.
tag NbtList
options JsonSerializerOptions
An object that specifies serialization options to use.