JsonNumberHandling
Determines how JsonSerializer handles numbers when serializing and deserializing.
The behavior of WriteAsString and AllowNamedFloatingPointLiterals is not defined by the JSON specification. Altering the default number handling can potentially produce JSON that cannot be parsed by other JSON implementations.
The "NaN", "Infinity", and "-Infinity" String tokens can be read as
floating-point constants, and the Single and Double values for these
constants (such as PositiveInfinity and NaN)
will be written as their corresponding JSON string representations.
Strings that have escaped characters will be unescaped before reading.
Leading or trailing trivia within the string token, including whitespace, is not allowed.
This behavior is not defined by the JSON specification. Altering the default number handling can potentially produce JSON that cannot be parsed by other JSON implementations.
Numbers can be read from String tokens.
Does not prevent numbers from being read from Number token.
Strings that have escaped characters will be unescaped before reading.
Leading or trailing trivia within the string token, including whitespace, is not allowed.
Strict = 0
Numbers will only be read from Number tokens and will only be written as JSON numbers (without quotes).
WriteAsString = 2
Numbers will be written as JSON strings (with quotes), not as JSON numbers.
This behavior is not defined by the JSON specification. Altering the default number handling can potentially produce JSON that cannot be parsed by other JSON implementations.