Validate JSON and find the exact syntax error
The validator runs your text through the browser's strict JSON parser. When parsing fails, it reports where the parser stopped so you can jump straight to the mistake.
Worked example
Trailing comma
{
"name": "Ada",
"skills": ["math", "logic"],
}Invalid JSON (Line: 4)
- Parser message
- Expected double-quoted property name in JSON at position 50 (line 4 column 1)
- Line
- 4
- Column
- 1
Single-quoted key
{
"name": "Ada",
'role': "admin"
}Invalid JSON (Line: 3)
- Parser message
- Expected double-quoted property name in JSON at position 21 (line 3 column 3)
- Line
- 3
- Column
- 3
Unquoted key
{
"name": "Ada",
age: 36
}Invalid JSON (Line: 3)
- Parser message
- Expected double-quoted property name in JSON at position 21 (line 3 column 3)
- Line
- 3
- Column
- 3
The messages above were produced at build time by the V8 JSON parser used in Chrome and Edge. Firefox and Safari word errors differently, but the mistake is the same.
Rules the formatter follows
- Keys and strings must use double quotes; single quotes and bare words are rejected.
- A comma may only separate two values, so a comma right before } or ] is a syntax error.
- Line and column count from 1 and mark where the parser stopped, which is often just after the real mistake, so check the character before it too.