Show / Hide Table of Contents

Class DictionaryObjectConverter

Converts System.Collections.Generic.Dictionary<TKey, TValue> using primitive CLR types instead of System.Text.Json.JsonElement. System.Text.Json by default deserializes object values as System.Text.Json.JsonElement, which breaks code that expects string, int, or nested dictionaries. XrplBinaryCodec and wallet signing rely on primitive CLR types in dictionaries.

Inheritance
object
JsonConverter
JsonConverter<Dictionary<string, object>>
DictionaryObjectConverter
Namespace: Xrpl.Client.Json.Converters
Assembly: Xrpl.dll
Syntax
public sealed class DictionaryObjectConverter : JsonConverter<Dictionary<string, object>>

Methods

| Edit this page View Source

Read(ref Utf8JsonReader, Type, JsonSerializerOptions)

Reads and converts the JSON to type System.Collections.Generic.Dictionary<string, object>.

Declaration
public override Dictionary<string, object> 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
Dictionary<string, object>

The converted value.

Overrides
System.Text.Json.Serialization.JsonConverter<System.Collections.Generic.Dictionary<string, object>>.Read(ref System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions)
| Edit this page View Source

Write(Utf8JsonWriter, Dictionary<string, object>, JsonSerializerOptions)

Writes a specified value as JSON.

Declaration
public override void Write(Utf8JsonWriter writer, Dictionary<string, object> value, JsonSerializerOptions options)
Parameters
Type Name Description
Utf8JsonWriter writer

The writer to write to.

Dictionary<string, object> value

The value to convert to JSON.

JsonSerializerOptions options

An object that specifies serialization options to use.

Overrides
System.Text.Json.Serialization.JsonConverter<System.Collections.Generic.Dictionary<string, object>>.Write(System.Text.Json.Utf8JsonWriter, System.Collections.Generic.Dictionary<string, object>, System.Text.Json.JsonSerializerOptions)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX