Invalid Number Format in JSON
JSON numbers have strict formatting rules. They cannot have leading zeros (except 0 itself), cannot use hexadecimal (0xFF), cannot have a trailing decimal point (10.), and cannot start with a plus sign (+10). Only standard decimal notation and scientific notation (1.5e10) are allowed.
Why It Matters
The JSON parser rejects the document at the invalid number. This commonly occurs when copying numbers from programming languages that have more flexible number formatting rules.
Common Causes
- Copying numbers from code that uses hex (0xFF), octal (0755), or a leading zero, none of which JSON accepts.
- Writing a value like 10. with a trailing decimal point and no following digit.
- Prefixing a positive number with a plus sign, which JSON does not allow.
Code Examples
{
"count": 01,
"hex": 0xFF,
"price": 10.,
"positive": +5,
"octal": 0755
}{
"count": 1,
"hex": 255,
"price": 10.0,
"positive": 5,
"octal": 493
}How to Fix
- 1Remove leading zeros from numbers. Use 1 not 01, use 7 not 007.
- 2Convert hexadecimal values to decimal: 0xFF becomes 255.
- 3Always include a digit after the decimal point: 10.0 not 10.
- 4Remove the plus sign from positive numbers: 5 not +5.
Frequently Asked Questions
What number formats are valid in JSON?
Can JSON numbers have a leading zero?
How do I represent very large or precise numbers safely?
Check Your JSON Now
Our JSON validator detects this error automatically and shows the exact line and column.
Open JSON ValidatorCloudways · Managed Cloud Hosting
Fix this JSON error, then deploy on Cloudways managed cloud (AWS, GCP, DigitalOcean).
Free 3-day trial · 30% off 3 months + free site migration with code MIGRATE303
Related JSON Errors
Invalid Value Type in JSON
JSON only supports strings, numbers, booleans, null, objects, and arrays. Learn how to fix invalid value types like undefined, NaN, Infinity, and dates.
Unexpected Token in JSON
Fix the unexpected token error in JSON fast. See why parsers fail on trailing commas, single quotes, unquoted keys, and comments, with clear examples.
Invalid Escape Characters in JSON
Learn which escape characters are valid in JSON strings and how to fix the invalid ones. Windows file paths and regex patterns are the usual culprits.