Class ScientificDecimalConverter
Handles decimal values that may arrive in scientific notation (e.g. 1e-05). System.Text.Json does not natively parse scientific notation into decimal, so this converter reads the raw value and uses decimal.Parse with appropriate styles.
Inheritance
object
JsonConverter
JsonConverter<decimal>
ScientificDecimalConverter
Namespace: Xrpl.Client.Json.Converters
Assembly: Xrpl.dll
Syntax
public class ScientificDecimalConverter : JsonConverter<decimal>
Methods
| Edit this page View SourceRead(ref Utf8JsonReader, Type, JsonSerializerOptions)
Reads and converts the JSON to type decimal.
Declaration
public override decimal 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 |
|---|---|
| decimal | The converted value. |
Overrides
System.Text.Json.Serialization.JsonConverter<decimal>.Read(ref System.Text.Json.Utf8JsonReader, System.Type, System.Text.Json.JsonSerializerOptions)
|
Edit this page
View Source
Write(Utf8JsonWriter, decimal, JsonSerializerOptions)
Writes a specified value as JSON.
Declaration
public override void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| Utf8JsonWriter | writer | The writer to write to. |
| decimal | value | The value to convert to JSON. |
| JsonSerializerOptions | options | An object that specifies serialization options to use. |
Overrides
System.Text.Json.Serialization.JsonConverter<decimal>.Write(System.Text.Json.Utf8JsonWriter, decimal, System.Text.Json.JsonSerializerOptions)