JSON Validator
Says what is wrong with a JSON document and where, then formats it the way you want it.
How JSON Validation Works
What is JSON Validation?
JSON has a small, strict grammar. A document is either valid or it is not, and the usual reason it is not is a detail that reads perfectly well to a person: a comma before a closing brace, a key in single quotes, a value that JavaScript allows and JSON does not.
Validating means finding the first place the grammar breaks and saying where. Formatting is the other half of the job, and only makes sense once the document parses.
How to Use
- Paste the document. It is checked on every keystroke, so there is nothing to press.
- When it does not parse, the line is quoted back with a caret under the exact column, and nothing else on the page pretends to describe it.
- The indent buttons set the shape of the output, including Minified. Sort keys, escape unicode and compact arrays can be combined with any of them.
- Structure below shows the tree, how many values of each type there are, and which key names recur.
What Gets Caught
| Trailing comma | [1, 2, ], allowed in JavaScript and not in JSON |
| Wrong quotes | A key or string in single quotes, or with no quotes at all |
| Wrong bracket | An array closed with a brace, or an object with a bracket |
| Not JSON values | undefined, NaN, Infinity, and True with a capital |
| Number shapes | A leading zero, a bare decimal point, an empty exponent |
| String contents | An invalid escape, a short \u, a raw control character |
Important Notes
- Only the first error is reported. JSON gives a parser no reliable way to carry on afterwards, so a second message would be a guess.
- Duplicate keys are not an error in JSON. The last one wins, and the formatted output will contain only that one.
- Numbers are read as double precision, so an integer beyond about 9 quadrillion loses digits on the way through, and
1.0comes back as1. - The order of object keys is preserved unless sorting is switched on. JSON itself does not define an order.
Privacy & Security: the document is parsed in your browser. Nothing you paste is sent anywhere, and the tool works with the network disconnected.