Description
Test strict JSON number grammar and independently flag an optional minus followed by zero and another digit.
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 strict JSON number grammar and independently flag an optional minus followed by zero and another digit.
When to use this tool
Use JSON Number Leading Zero Grammar Flag 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 valid, leadingZero. Inspect valid, leadingZero before interpreting the associated values.
Test strict JSON number grammar and independently flag an optional minus followed by zero and another digit.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| lexeme | Supplied token spelling; it is not automatically decoded text. | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| valid | Whether this narrowly scoped condition passes; it is not necessarily full-document validity. | Required. Boolean. |
| leadingZero | Leading Zero | Required. Boolean. |
{
"input": {
"lexeme": "01"
},
"output": {
"valid": false,
"leadingZero": true
}
} Limitations and assumptions
- Flags can describe invalid tokens; leadingZero is a narrow diagnostic and does not explain every grammar failure.
- 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 Integer Decimal Equivalence Token
Test JSON number grammar first; invalid tokens return false flags and an empty canonical string.