Class ReadOnlyArrayJsonConverter<T>
- Namespace
- GroupeIsa.Neos.Shared.Collections
- Assembly
- GroupeIsa.Neos.Shared.dll
Provides functionality to convert a ReadOnlyArray<T> to and from JSON format.
public class ReadOnlyArrayJsonConverter<T> : JsonConverter<ReadOnlyArray<T>>
Type Parameters
TThe type of elements in the ReadOnlyArray<T>.
- Inheritance
-
ReadOnlyArrayJsonConverter<T>
- Inherited Members
Remarks
This converter handles serialization and deserialization of ReadOnlyArray<T> instances containing strings. During deserialization, the JSON array is converted into a ReadOnlyArray<T>. During serialization, the ReadOnlyArray<T> is written as a JSON array.
Methods
Read(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type ReadOnlyArray.
public override ReadOnlyArray<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
readerUtf8JsonReaderThe reader.
typeToConvertTypeThe type to convert.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.
Returns
- ReadOnlyArray<T>
The converted value.
Write(Utf8JsonWriter, ReadOnlyArray<T>, JsonSerializerOptions)
Writes a specified value as JSON.
public override void Write(Utf8JsonWriter writer, ReadOnlyArray<T> value, JsonSerializerOptions options)
Parameters
writerUtf8JsonWriterThe writer to write to.
valueReadOnlyArray<T>The value to convert to JSON.
optionsJsonSerializerOptionsAn object that specifies serialization options to use.