JSON runs the modern web — every API speaks it. But one missing comma breaks the whole file. Here's how to format, validate and minify it, and how to read the errors when it goes wrong.
What JSON is (and its strict rules)
JSON — JavaScript Object Notation — is a plain-text way to represent structured data: objects in { }, arrays in [ ], plus strings, numbers, booleans and null. Its power is being both human-readable and machine-parseable. But it is strict, and that's where people get caught:
- Keys and string values must use double quotes — never single quotes.
- No trailing commas. A comma after the last item is invalid (even though JavaScript allows it).
- No comments. JSON has no comment syntax at all.
- Numbers have no leading zeros or
+signs.
Beautify, validate or minify JSON in your browser — your data is never uploaded.
Open JSON FormatterReading validation errors
When a validator says "Unexpected token at line 12", it's telling you where parsing failed — which is often just after the real mistake. The classic culprits:
- Trailing comma before a
}or]. - Missing comma between two items.
- Unquoted key —
{name: "x"}should be{"name": "x"}. - Unescaped quote inside a string.
Paste into a formatter and it will point to the exact line — far faster than hunting by eye.
Beautify vs. minify — when to use each
Beautify (pretty-print)
Adds indentation and line breaks so the structure is readable. Use it while developing and debugging — when you need to understand or edit the data by hand.
Minify
Strips every unnecessary space and newline into one compact line. Use it for production — smaller payloads mean faster API responses and less bandwidth. The data is identical; only the whitespace differs.
Rule of thumb: beautify for humans, minify for machines.
A note on privacy
Developers often paste API responses containing tokens, customer records or internal data into random online formatters — which upload it to a stranger's server. Our JSON tools run entirely in your browser, so sensitive payloads never leave your machine. For related tasks, see the JSON Compare and Base64 tools.