What counts as valid JSON
The validator applies RFC 8259 through the browser's own JSON.parse. When that rejects the text, a second, tolerant parser locates the first problem, so the line and column do not depend on how your browser words its error message.
The errors people hit most
| Input | Why it fails |
|---|---|
{"a": 1,} | Trailing comma. JSON has no comma after the last member. |
{'a': 1} | Single quotes. Strings and keys need double quotes. |
{a: 1} | Unquoted key. That is a JavaScript object literal, not JSON. |
{"a": 01} | Leading zero in a number. |
{"a": NaN} | NaN, Infinity and undefined are not JSON values. |
{"a": 1} {"b": 2} | Two values. A document holds one; wrap several in an array. |
A valid document gets a short report: the type of the root, the number of keys and values, and the nesting depth. To fix an invalid one automatically, open it in the JSON formatter and choose Repair.