How to Format and Validate JSON (and Find What's Actually Broken)
Turning a wall of minified JSON into something readable, and pinpointing the exact character breaking your JSON parser.
JSON is unforgiving — a single missing comma or an extra trailing one will make an entire payload fail to parse, and the error message from most languages ("Unexpected token") doesn't tell you where the problem actually is. A formatter does two jobs at once: it makes JSON readable, and it tells you exactly where it's broken.
Why minified JSON is hard to debug
API responses and config files are often minified — no line breaks, no indentation — to save space. That's efficient for machines but unreadable for humans; a 200-line JSON structure collapsed onto one line makes it nearly impossible to spot a missing bracket by eye.
How to format and validate JSON
- Open the JSON Formatter.
- Paste in your JSON, minified or not.
- The tool beautifies it with proper indentation, or flags exactly where the syntax breaks if it's invalid.
The most common JSON mistakes
- Trailing commas: valid in JavaScript object literals, invalid in strict JSON — a common source of "works in my code, fails when parsed" bugs.
- Single quotes: JSON requires double quotes for strings and keys; single quotes will fail validation even though many languages accept them elsewhere.
- Unescaped characters inside strings: a raw newline or unescaped quote inside a string value breaks the whole structure.
Minifying for production
Once your JSON is correct, the same tool can minify it back down — useful for shipping config or API payloads without the extra whitespace, while keeping a formatted copy for your own reference.
Last updated
July 13, 2026