Table of Contents

Class JsonValueWriter

Namespace
MassiveDotNet.Serialization
Assembly
MassiveDotNet.dll

Writes a scalar whose .NET type and wire form disagree, so that a model this SDK deserializes serializes back to the shape the service sent.

public static class JsonValueWriter
Inheritance
JsonValueWriter
Inherited Members

Remarks

Only decimal needs this today. Every other scalar the generated converters carry writes through a Utf8JsonWriter method directly, because its .NET type and its JSON token already agree; the fractional-share family does not, since it is a number the description declares as a string (D38).

The counterpart to JsonValueReader, and here for the same reason: one implementation, tested once, rather than the same formatting emitted into seventeen generated converters and hand-written into the streaming ones, where it could drift between them.

Methods

WriteDecimalString(Utf8JsonWriter, string, decimal)

Writes a decimal property as the JSON string the wire uses.

public static void WriteDecimalString(Utf8JsonWriter writer, string property, decimal value)

Parameters

writer Utf8JsonWriter

The writer to write to.

property string

The wire property name.

value decimal

The value to write.

Remarks

Formatted straight into UTF-8, so writing a page of rows allocates no strings -- the same concern that moved this family off string in the first place. The invariant culture is not a detail: a culture using , as its decimal separator would emit a value the service, and this SDK's own reader, would refuse.

Exceptions

ArgumentNullException

writer is null.