JSON Beautifier & Formatter
Paste JSON to pretty-print it with 2 or 4 spaces, or minify it. Invalid JSON gets the exact line and column of the error, and Auto-Repair fixes trailing commas, unquoted keys and single-quoted strings. Everything runs in your browser; nothing is uploaded.
More from JSONBeautify
Guides
Frequently Asked Questions
Is my JSON private?
Yes. Parsing and validation happen in your browser. Your payload is never transmitted to a server, so it is safe to paste data you would not upload elsewhere.
Why does it say my JSON is invalid when another tool accepts it?
Most other tools are lenient. Strict JSON forbids trailing commas, comments, single quotes, unquoted keys, and NaN. JSONBeautify follows the spec, so it reports the exact position of the first violation instead of silently coercing your input.
Does minifying JSON break anything?
No, for valid JSON. Whitespace outside string literals is insignificant, so removing it is safe. Keep key order in mind if a consumer depends on it, since beautifying and re-minifying preserves order but reformatting tools are free to differ.
🧭 Pro Tips & Gotchas
Using the repair pass deliberately
- Strict
JSON.parseis the default; the repair pass only runs when the first parse throws, so valid JSON is never mutated. - Repair handles the three shapes humans generate: single quotes → double, trailing commas removed, unquoted keys quoted. Anything else still fails loudly.
- The minify output is
JSON.stringifyof the parsed value, so key order survives but every semantic duplicate key collapses to its last value.
Gotchas
- Duplicate keys are silently lost.
{ "a": 1, "a": 2 }parses fine and reports one key — use this tool to detect them only by comparing input/output key counts. - Repair will happily quote a bare word that was meant to be a value typo, turning
{ status: ok }into{"status":"ok"}wheretruewas intended. - Big integers lose precision before display:
12345678901234567890becomes1.2345678901234568e+19. JSON has no int64 — parse as string (losslesslibraries) when it matters. NaN,Infinity,undefined, and comments (//,/ /) are not repaired in — they are not JSON. A file full of them is a JS object literal, andeval-ing it to "fix" that is an injection hole.- Leading zeros (
01) and hex (0x1F) are invalid JSON numbers and stay invalid; the repair pass does not invent numeric support. - A UTF-8 BOM makes
JSON.parsethrow before any of this logic runs. Strip\uFEFFfirst if you paste from PowerShell or Excel.