Skip to content

Main content

JSON Scalar Nonfinite Serialization Guard Tool

Compute json scalar nonfinite serialization guard from explicit bounded inputs.

Loading tool…

Description

Accept a numeric-like lexeme including optional plus signs, decimal forms, Infinity, and NaN.

A JSON number's grammar, decimal spelling, and parsed binary value are different layers. Exponents, leading zeros, and negative zero can carry lexical information lost during numeric conversion.

Accept a numeric-like lexeme including optional plus signs, decimal forms, Infinity, and NaN.

When to use this tool

Use JSON Scalar Nonfinite Serialization Guard when you need a numeric token's spelling or serialization convention.

How to use the tool and how it works

  1. Enter lexeme. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read finite, json. Inspect finite before interpreting the associated values.

Accept a numeric-like lexeme including optional plus signs, decimal forms, Infinity, and NaN. Convert with Number; return finite and a serialized number, or an empty json string for nonfinite values.1

Input fieldMeaning and unitsAccepted input
lexemeNumeric-like spelling accepted by the broader implemented grammar, including Infinity and NaN.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
finiteFiniteRequired. Boolean.
jsonSerialized finite Number or empty-string sentinel when finite is false.Required. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "lexeme": "1e309"
  },
  "output": {
    "finite": false,
    "json": ""
  }
}

Limitations and assumptions

  • This input grammar is broader than JSON number syntax; an empty serialization is a sentinel, not JSON null or a valid numeric document.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use an exact decimal parser when preserving large integers, decimal scale, or lexical round trips is required.

References

  1. Calculation and input contract: json/json-scalar-nonfinite-serialization-guard — tool.io

Similar or alternative tools