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 YAML ⇄ JSON converter.
- 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.
Keep reading
Why Your Regex Doesn't Match: The 7 Most Common Mistakes
A pattern that returns nothing is rarely broken syntax. It is usually one of these seven behaviours doing exactly what you told it to.
What's Inside a JWT — And What You Should Never Put There
A JWT is three Base64url strings and a signature. Understanding which part is secret (none of them) changes how you design with it.
JSON vs YAML: When Each One Actually Makes Sense
They encode the same data. The differences that matter are about who writes the file, who reads it, and what happens when someone makes a typo.
How CPF and CNPJ Check Digits Work (With the Algorithm)
A step-by-step walk through the mod-11 arithmetic behind Brazilian document numbers, including the 2026 alphanumeric CNPJ.
Related tools
Format and validate your JSON data
Compare two JSON documents side by side