How to validate JSON
- Paste your JSON into the editor. It is checked as you type.
- If it is valid, the status line turns green and shows the size in bytes.
- If it is invalid, you see the parser's message with the exact line and column, and the cursor jumps to the offending character so you can fix it straight away.
- Press Format to pretty-print the corrected JSON, or Minify to compact it.
The most common JSON errors
JSON is stricter than JavaScript. These mistakes cause almost every "Unexpected token" error:
- Trailing commas after the last item in an object or array, such as
[1, 2,]. - Single quotes instead of double quotes around strings and keys.
- Unquoted keys such as
{name: "x"}; every key must be a double-quoted string. - Comments, which standard JSON does not allow.
- Special values such as
undefined,NaNorInfinity, which are not valid JSON. - Unescaped characters inside strings, such as a raw newline or a backslash in a Windows path.
Validation uses your browser's native JSON parser, the same one your JavaScript code uses, so if it passes here it will parse in your app. Nothing is uploaded, which makes it safe for API keys, tokens and customer data.
FAQ
Why is my JSON invalid when it works in JavaScript?
JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. JSON allows none of these, so code that runs in JavaScript can still be invalid JSON.
Does the validator check against a JSON Schema?
No, it checks syntax only. To check structure, generate a schema with the JSON to Types tool and use a schema validator in your project.
Can I validate JSON Lines (JSONL)?
Each line of a JSONL file is a separate JSON document, so this validator will report an error after the first line. Use the JSONL Validator in the AI category for that format.