Skip to main content

NewtonsoftParityDecimalConverter

Namespace: Meshmakers.Octo.Runtime.Contracts.Serialization

Decimal twin of NewtonsoftParityDoubleConverter. Whole-number decimals render with a trailing .0 so the round-trip lands as a JSON real (and thus boxes as Double) rather than a JSON integer (which would box as Int64). Note: decimal-vs-double parity itself is irreducible — JSON has no decimal marker.

public sealed class NewtonsoftParityDecimalConverter : JsonConverter<Decimal>

Inheritance Object → JsonConverter → JsonConverter<Decimal> → NewtonsoftParityDecimalConverter

Properties

HandleNull

public bool HandleNull { get; }

Property Value

Boolean

Type

public Type Type { get; }

Property Value

Type

Constructors

NewtonsoftParityDecimalConverter()

public NewtonsoftParityDecimalConverter()

Methods

Read(out Utf8JsonReader, Type, JsonSerializerOptions)

public decimal Read(out Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

Parameters

reader Utf8JsonReader

typeToConvert Type

options JsonSerializerOptions

Returns

Decimal

Write(Utf8JsonWriter, Decimal, JsonSerializerOptions)

public void Write(Utf8JsonWriter writer, decimal value, JsonSerializerOptions options)

Parameters

writer Utf8JsonWriter

value Decimal

options JsonSerializerOptions