Description
Test JSON number grammar first; invalid tokens return false flags and an empty canonical string.
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.
Test JSON number grammar first; invalid tokens return false flags and an empty canonical string.
When to use this tool
Use JSON Integer Decimal Equivalence Token when you need a numeric token's spelling or serialization convention.
How to use the tool and how it works
- Enter token. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read validNumberToken, integerValue, canonical. Inspect validNumberToken, integerValue before interpreting the associated values.
Test JSON number grammar first; invalid tokens return false flags and an empty canonical string. Valid tokens convert to a finite Number, report Number.isInteger, and serialize that value.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| token | Token | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| validNumberToken | Valid Number Token | Required. Boolean. |
| integerValue | Integer Value | Required. Boolean. |
| canonical | JavaScript serialization after finite binary Number conversion; may lose decimal precision. | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"token": "1.0"
},
"output": {
"validNumberToken": true,
"integerValue": true,
"canonical": "1"
}
} Limitations and assumptions
- Large integers can round and tiny values can underflow; canonical is JavaScript numeric serialization, not exact decimal or full JSON canonicalization.
- 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 Scalar Nonfinite Serialization Guard
Accept a numeric-like lexeme including optional plus signs, decimal forms, Infinity, and NaN.
- JSON Number Scale Token
Validate a JSON number token, count fractional digits, parse its optional signed exponent as a safe integer, and return decimalScale = fractionDigits - exponent.