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
- Enter lexeme. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| lexeme | Numeric-like spelling accepted by the broader implemented grammar, including Infinity and NaN. | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| finite | Finite | Required. Boolean. |
| json | Serialized finite Number or empty-string sentinel when finite is false. | Required. Text; maximum UTF-16 length 8192. |
{
"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
Similar or alternative tools
- JSON Integer Decimal Equivalence Token
Test JSON number grammar first; invalid tokens return false flags and an empty canonical string.
- JSON Number Leading Zero Grammar Flag
Test strict JSON number grammar and independently flag an optional minus followed by zero and another digit.