How to validate JSON
- Paste the JSON into the box, or press Insert example (it has one deliberate mistake).
- Read the verdict in the result card. Valid JSON shows its root type, the number of keys and the nesting depth, plus a tidied copy.
- If it is invalid, the card shows the line and column of the first error, the reason and the text around it with a caret. Fix that one spot and the check runs again as you type.
The checker only reports the first error, because everything after a syntax error is ambiguous. Fix it and the next one, if any, appears.
The most common JSON errors and what they look like here
A valid document first:
{
"id": 7,
"name": "Ada",
"roles": ["admin", "dev"]
}Add one mistake and the tool says exactly where:
| Mistake | What the validator says |
|---|---|
| Missing comma between two properties | Invalid JSON at line 4, column 3: Expected ',' or '}' after a value but found '"' (missing comma?). |
| Single-quoted string | Invalid JSON at line 1, column 10: Strings need double quotes, not single quotes. |
| Number with a leading zero | Invalid JSON at line 1, column 15: Numbers cannot have leading zeros. |
| Wrong closing bracket | Invalid JSON at line 1, column 15: Expected ',' or ']' after an array item but found '}'. |
| Raw line break inside a string | Invalid JSON at line 1, column 18: A raw line break or control character inside a string: write it as \n or \t. |
| Two values in one document | Invalid JSON at line 1, column 10: Unexpected '{' after the end of the JSON value (only one value is allowed). |
Each message ends with the position, and the output box shows the offending line with a ^ under the problem, for instance for the missing comma:
Line 4, column 3 "roles": [] ^
What counts as valid JSON
This validator follows RFC 8259, the strict standard. Things that many parsers accept but are not valid:
- Trailing commas:
[1, 2,] - Single quotes:
{'a': 1} - Unquoted keys:
{a: 1} - Comments:
// noteor/* note */ - Hex,
+1,.5,5.,NaN,Infinity,undefined - Control characters (raw tabs or line breaks) inside strings
A bare value is valid: 42, "text" and null are all JSON documents, not only objects and arrays. Duplicate keys in one object are allowed by the grammar (the standard calls the behaviour unpredictable), so the validator does not flag them.
Why a validator can disagree with your code
If your application accepts JSON this page rejects, the library is probably lenient. JavaScript's own JSON.parse is strict, but Python's json module accepts NaN and Infinity, many YAML and JSON5 parsers accept comments and trailing commas, and some servers strip a leading byte order mark. Being strict is the point of a validator: data that passes here is accepted by every standard parser.
The error text of JSON.parse differs between browsers (Chrome, Firefox and Safari word it in three ways and do not all give a position). This tool uses its own checker, so the message and position are the same everywhere; it was tested against the browser's parser on tens of thousands of random strings to make sure the verdict (valid or not) always matches.
After the JSON is valid
Use the JSON formatter to pretty-print, minify or sort it. To get a spreadsheet from an array of objects use JSON to CSV. If your JSON is inside a token, the JWT decoder splits and reads it. Everything stays in your browser.
Related tools
- JSON formatter – format, minify and sort the JSON once it is valid
- JSON to CSV converter
- JWT decoder – decode the JSON inside a token
- XML formatter – the same check for XML
JSON validator FAQ
How do I check if my JSON is valid?
Paste it into the box. The result card says Valid JSON, or gives the line, the column and the reason for the first error.
Why does it say "Unexpected token"-style errors differently from my browser?
Browsers word JSON.parse errors differently and some give no position. This validator has its own strict checker, so the message and position are identical everywhere.
Is a trailing comma allowed in JSON?
No. [1, 2,] and {"a": 1,} are invalid in strict JSON. Remove the last comma.
Are comments allowed in JSON?
No. JSON has no comments. Remove them, or use a format such as JSONC or JSON5 that your tools explicitly support.
Does it validate against a JSON Schema?
No. It checks syntax only: whether the text is well-formed JSON. Schema checks (required fields, types) need a schema validator.
Is my JSON sent to a server?
No. The check runs in your browser and nothing is uploaded or stored.
Can it find more than one error?
It reports the first error. After a syntax error the rest of the text cannot be read reliably, so fix it and the next error, if any, is shown.