Class InnerObjectListConverter<T>
Reads and writes an STArray of inner objects as a plain list of those objects.
Inheritance
Namespace: Xrpl.Models.Ledger
Assembly: Xrpl.dll
Syntax
public abstract class InnerObjectListConverter<T> : JsonConverter<List<T>>
Type Parameters
| Name | Description |
|---|---|
| T | The inner object type. |
Remarks
rippled renders every member of an STArray wrapped in an object named after the inner
object's field ([{"Majority": {...}}, ...]), so binding the array straight to a list
of the inner type yields elements with every field left at its default. This converter
unwraps on read and wraps again on write. An element that is not wrapped is read as the
inner object itself, so a list built by hand in the flat shape still binds.
Constructors
| Edit this page View SourceInnerObjectListConverter(string)
Declaration
protected InnerObjectListConverter(string wrapperName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | wrapperName | The field name rippled wraps each element in. |
Methods
| Edit this page View SourceRead(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type System.Collections.Generic.List{`0}.
Declaration
public override List<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| Utf8JsonReader | reader | The reader. |
| Type | typeToConvert | The type to convert. |
| JsonSerializerOptions | options | An object that specifies serialization options to use. |
Returns
| Type | Description |
|---|---|
| List<T> | The converted value. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| JsonException | The value is neither null nor an array. |
Write(Utf8JsonWriter, List<T>, JsonSerializerOptions)
Writes a specified value as JSON.
Declaration
public override void Write(Utf8JsonWriter writer, List<T> value, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| Utf8JsonWriter | writer | The writer to write to. |
| List<T> | value | The value to convert to JSON. |
| JsonSerializerOptions | options | An object that specifies serialization options to use. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| JsonException | The list holds a null element, which no STArray can carry. |