Class JsonObjectWriter
Builds a single flat JSON object literal one property at a time, handling comma
placement, string escaping, and null values. Used to compose small fixed wire DTOs.
Inheritance
JsonObjectWriter
Assembly: Serenity.StructuredPersistence.Json.dll
Syntax
public sealed class JsonObjectWriter
Constructors
JsonObjectWriter()
Declaration
public JsonObjectWriter()
Methods
ToString()
Declaration
public override string ToString()
Returns
Overrides
WriteDouble(string, double)
Writes a double property as a JSON number using round-trip ("G17") formatting, so the
exact double value survives the encode/decode round trip.
Declaration
public JsonObjectWriter WriteDouble(string name, double value)
Parameters
Returns
WriteInt(string, int)
Writes an integer property as a JSON number.
Declaration
public JsonObjectWriter WriteInt(string name, int value)
Parameters
Returns
WriteQuotedLong(string, long)
Writes a 64-bit integer property as a QUOTED JSON string (not a JSON number). JSON
numbers are commonly parsed into IEEE-754 doubles, which only exactly represent
integers up to 2^53 — far below the range of real 64-bit values. Quoting the digits
keeps the exact value intact across the wire for any conformant reader.
Declaration
public JsonObjectWriter WriteQuotedLong(string name, long value)
Parameters
Returns
WriteString(string, string)
Writes a string property, or the JSON null literal when value is null.
Declaration
public JsonObjectWriter WriteString(string name, string value)
Parameters
Returns