Table of Contents

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

T

The 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

reader Utf8JsonReader

The reader.

typeToConvert Type

The type to convert.

options JsonSerializerOptions

An 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

writer Utf8JsonWriter

The writer to write to.

value ReadOnlyArray<T>

The value to convert to JSON.

options JsonSerializerOptions

An object that specifies serialization options to use.