What it does
The JSON Validator checks whether text is valid JSON. When it is not, it points to the exact line and column of the problem, shows the line with an arrow under the broken character, and explains the likely fix in plain English.
How to use it
- Paste your JSON into the editor.
- Click Validate.
- Read the result: Valid JSON, or Invalid JSON with the position, a snippet and a hint.
- Fix the line and validate again, or click Auto-fix to repair it for you. The card then lists what was changed.
Example
{
"name": "Ada",
"skills": ["math", "code",],
}
This fails at line 3: the comma after "code" has nothing after it. The hint says Remove the trailing comma before the closing bracket. The same mistake appears again before the closing brace on line 4.
The mistakes it explains
| Mistake | Fix |
|---|---|
Trailing comma [1, 2,] |
Remove the last comma |
Single quotes 'name' |
Use double quotes "name" |
Unquoted keys {name: 1} |
Quote the key: {"name": 1} |
Comments // note |
Remove them; JSON has no comments |
NaN, Infinity, undefined |
Use null or a number |
| Missing bracket or quote at the end | Close the bracket, brace or string |
Good to know
- JSON is stricter than JavaScript: what works in a
.jsfile can still be invalid JSON. - Configuration formats such as JSON5 or JSONC allow comments and trailing commas; standard JSON parsers do not.
- Once it is valid, the JSON Formatter can indent, minify or sort it.
FAQ
Why is my file valid in my editor but invalid here?
Editors such as VS Code often treat settings.json as JSONC (JSON with comments). Remove comments and trailing commas for strict JSON.
Does it check my data against a schema? No, it checks syntax only. To describe the shape of your data, JSON to Code can generate a JSON Schema from an example.