CrystalJsonSettings.FloatFormat

Namespace: SnowBank.Data.Json · enum

Implements: IComparable, ISpanFormattable, IFormattable, IConvertible

Rules for serializing special floating points numbers, like NaN or PositiveInfinity

Fields

Default

Default = 0

Use the global default for floating points, which is Symbol by default

JavaScript

JavaScript = 4

Use the JavaScript notation (Number.NaN, Number.POSITIVE_INFINITY, ...). This will produce invalid JSON and is only valid when targeting JavaScript

Null

Null = 3

Use the `null` token when serializing NaN, PositiveInfinity or NegativeInfinity. The generated JSON will be conforming to RFC7159, but some information may be lost (all NaN and Inifinities will be replaced by null which may be deserialized as 0)

String

String = 2

Use string literals like "NaN", "Infinity" or "-Infinity" (with double quotes), similarly to what JSON.NET is doing. The generated JSON will conform to RFC7159, but the caller may not expect a JSON string literal instead of a JSON number, and may either fail or replace all values by NaN !

Symbol

Symbol = 1

Use symbols like `NaN`, `Infinity` or `-Infinity` (without quotes). Note: The generated JSON will not strictly conform to RFC7159, which does not specify these symbols