How to Format, Validate, and Compare JSON
JSON is everywhere — API responses, config files, log lines — and it is almost always handed to you minified, escaped, or subtly broken. Here is a quick workflow for making sense of it.
1. Format it first
Minified JSON is unreadable. Paste it into the JSON formatter and it is re-indented into a tree you can actually scan. Formatting also surfaces structure: missing brackets and trailing commas jump out once everything is on its own line.
> Tip: if you only need to shrink JSON for a request body, the same tool can > minify it back down.
2. Validate as you go
A formatter that fails to parse is telling you something: there is a syntax error. The usual culprits are:
- A trailing comma after the last item in an array or object.
- Single quotes instead of double quotes around keys or strings.
- Unescaped newlines or quotes inside a string value.
- A stray comment — JSON has none.
Fix them one at a time and re-format until the document parses cleanly.
3. Compare two versions
When an API changes or a test fails, you need to know what differs. Drop both payloads into the JSON diff tool. It normalises key order and formatting first, so you see real value changes instead of cosmetic noise.
4. Convert when you need another shape
Sometimes the fix is a different format entirely:
- Need a config file? Turn it into YAML with the
- Handed a spreadsheet export? The
CSV ⇄ JSON converter maps rows to objects and back.
A repeatable routine
- Format to make it readable.
- Validate by fixing whatever blocks parsing.
- Diff against a known-good version to spot changes.
- Convert to whatever the next step needs.
Every one of these runs entirely in your browser, so even production payloads stay on your machine. Bookmark the JSON formatter and you will reach for it constantly.