Single-quoted strings
Legal in JavaScript, illegal in JSON. Every string and every key must use double quotes.
Format, check and minify JSON in one place. When it will not parse, the error names the line and tells you what is actually wrong — not just where the parser gave up.
It parses your JSON, then writes it back out with one key per line and a fresh indent at every level of nesting. Because it parses rather than pattern-matches, anything it returns is guaranteed to be valid JSON — and anything it cannot return tells you exactly where the problem is.
{"sku":"A-100","title":"Linen shirt","price":58,"stock":{"s":4,"m":0,"l":12}}
{
"sku": "A-100",
"title": "Linen shirt",
"price": 58,
"stock": {
"s": 4,
"m": 0,
"l": 12
}
}
A browser's own JSON error messages are famously unhelpful. "Unexpected token } in JSON at position 247" tells you where the parser gave up, which is rarely where you made the mistake. This tool scans for the specific things people actually get wrong and names them:
Legal in JavaScript, illegal in JSON. Every string and every key must use double quotes.
[1, 2, 3,] is fine in modern JavaScript and rejected by every JSON parser.
JSON has none. If you need them, you want JSON5 or YAML, or a key called _comment.
{ name: "x" } is a JavaScript object literal, not JSON.
None, True and False mean you printed a Python dict instead of
serialising it. The tool says so.
Valid JavaScript numbers, but not valid JSON. They usually arrive from a maths error upstream.
{
'name': 'Acme Supply',
open: true,
// opening hours
"hours": [9, 17,],
"rating": NaN,
"owner": None
}
Ticking Sort keys A–Z reorders every object alphabetically, all the way down. Two uses for it:
Comparing two files. JSON objects have no defined key order, so two API responses with identical content can produce a completely unreadable diff. Sort both and the diff shows only what actually changed.
Finding a key in a large document. In a config file with ninety keys, alphabetical order means you can scan to roughly the right place instead of reading all of it.
Copied out of a browser console. Chrome's console prints objects with unquoted keys and single quotes. That display format is not JSON. Right-click the network response and use Copy response instead.
Printed by a program rather than serialised. Python's print(my_dict) gives
you {'a': None}. Use json.dumps(). PHP's print_r has the same
problem; use json_encode.
Hand-edited config. Trailing commas and comments, almost always, because the person editing it writes JavaScript all day.
Truncated in transit. A log line cut at a fixed width, or a response that hit a size limit. The tool will tell you which bracket never closed.
No. It is parsed by JSON.parse in your own browser. There is no server call — open the Network tab and press Format to confirm. That matters for JSON, which so often contains API keys, customer records or internal configuration.
Your app is probably not using a strict JSON parser. JavaScript's eval, Python's ast.literal_eval and several YAML parsers will all happily read things that are not JSON. Strict parsers — which is what the receiving end usually is — will not.
Up to a few megabytes comfortably. Everything runs on your device, so the limit is memory rather than a server quota. Past roughly 10 MB a browser textarea becomes sluggish regardless of what the parser is doing — at that size a command-line tool like jq is the better instrument.
Only the whitespace, with one thing worth knowing: numbers are re-serialised, so 1.50 comes back as 1.5 and 1e3 as 1000. Those are the same JSON number. If you are storing money or precise identifiers as numbers, that is a reason to store them as strings instead — not a reason to avoid formatting.
Those are files with one JSON document per line, so paste a single line at a time. Formatting the whole file at once would fail, because the file as a whole is not one JSON document.
Remove every unnecessary byte from JSON.
OpenLocate the exact line a JSON parse fails on.
OpenIndent and structure any HTML file.
OpenTurn minified HTML back into readable code.
OpenPretty-print HTML with the indent you want.
OpenLay out stylesheets with consistent indentation.
OpenLonger reading on formatting, indentation and minification.