Description
Check JSON number-token syntax separately from a leading-plus flag.
JSON distinguishes a member's absence, explicit null and other scalar or container values. Source number syntax differs from finite machine-number range, and reserializing a parsed value can change its spelling. Record delimiters also belong to a stream convention rather than automatically forming one valid JSON document.
Check JSON number-token syntax separately from a leading-plus flag.
When to use this tool
Use JSON Number Plus Sign Rejection when you already have numberText and need to check JSON number-token syntax separately from a leading-plus flag.
How to use the tool and how it works
- Enter numberText. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read validJsonNumber, leadingPlus. Inspect validJsonNumber, leadingPlus before interpreting the associated values.
Match optional -, a zero or nonzero-leading integer, optional decimal fraction and optional signed exponent, anchored to the entire input; leadingPlus tests the first character separately.1
JSON number syntax forbids a leading plus and leading integer zeros. Lexical validity is separate from the numeric range and precision supported by a parser.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| numberText | Number Text | Required. Text; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| validJsonNumber | Lexical JSON number grammar only; very large exponent forms may be true without a finite numeric value. | Required. Boolean. |
| leadingPlus | Independent flag for an initial +; that spelling is not a valid JSON number. | Required. Boolean. |
{
"input": {
"numberText": "+12"
},
"output": {
"validJsonNumber": false,
"leadingPlus": true
}
} Limitations and assumptions
- This is a lexical grammar check: no whitespace, leading integer zeros or leading + are accepted, but a huge exponent can be syntactically valid without being a finite portable numeric value.
- 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
Parse and validate the complete intended JSON schema or record stream when structural conformance matters. Preserve original source text when lexical spelling is significant, and decide explicitly whether absent and null members should share a default.
References
Similar or alternative tools
- JSON Single Member Default Policy
Select one JSON object member under an explicit default policy.
- JSON Scalar Append Delimiter Choice
Serialize one JSON scalar and append a selected record delimiter.