Format any JSON, instantly
Paste minified or messy JSON, get a clean indented, syntax-highlighted result. Validates as you type with precise line/column errors.
{
"users": [
{
"id": 1,
"name": "Ada",
"role": "admin"
},
{
"id": 2,
"name": "Linus",
"role": "engineer"
}
],
"total": 2
}How to format JSON: a complete step-by-step guide
The JSON Formatter turns minified or messy JSON into clean, indented, syntax-highlighted output. Pick your indentation, optionally sort keys for stable diffs, and validate against RFC 8259. Everything happens locally — your data never leaves the browser.
- 01
Paste minified or messy JSON
Drop a JSON document into the input panel — API responses, log entries, config files, or anything in between. Validation runs as you type, and any syntax error highlights with the exact line and column.
The tool accepts both pretty-printed and minified input; the output style is controlled separately by the indent selector. Paste with
⌘V/Ctrl+V.API responselog entryconfigminifiedinput · raw json1 line{"user":"ada","roles":["admin","founder"]}56 B · 1 lineminified - 02
Pick your indentation and ordering
Choose between
2 spaces(default for most language ecosystems),4 spaces(Python-friendly), orTab(Go and many older tools). Indentation re-applies live whenever you switch.Enable Sort keys for canonical, alphabetically-ordered output — useful for diffs, signatures, hashing, or stable build artifacts.
2 spaces4 spacestabsort keysoutput · 2 spacessorted{ "roles": [ "admin", "founder" ], "user": "ada" }87 B · 7 linesready to diff - 03
Fix syntax errors instantly
Trailing commas, unquoted keys, single quotes, comments, and other strict-JSON violations surface immediately with the exact position and error message. Fix the highlighted character and the formatter resumes automatically.
This formatter is strict RFC 8259 — if your input is JSON5 or JSONC, strip the comments first.
RFC 8259line · coltrailing commastrictvalidation errorline 2 · col 21SyntaxError: Unexpected token ',' at position 21 — trailing comma after "engineer"
fix → retryRFC 8259 § 4 - 04
Copy, download, or minify back
Copy the formatted result to your clipboard with one click, or save it as a
.jsonfile. Need to compact it again? Hit Minify to strip whitespace and round-trip back to a single line.Everything runs in the browser — open DevTools → Network to confirm zero outbound requests.
clipboard.jsonminifyprivacy-firstexport3 actions✓ Copied to clipboard ✓ Saved: formatted.json ✓ Minified back to 1 line ✓ 100% client-side
ready to shipsuccess
Production-grade JSON formatting tips
Sort keys for stable diffs
If you check JSON into git or sign payloads, enable Sort keys so the output is byte-identical regardless of original key order.
2 vs 4 vs tab
Match your existing style: package.json uses 2 spaces, Python projects often 4, Go tooling prefers tabs. Consistency > preference.
Validate before sending
Run the formatter on API request bodies before posting — it catches malformed payloads with line/col precision that beats curl's generic error.
Strict JSON only
Comments, trailing commas, and unquoted keys are JSON5 / JSONC — strip them with a separate tool first.
Big-integer precision
JavaScript loses precision past 2^53−1. Transport IDs and ledger amounts as strings.
Sensitive payloads
Nothing is uploaded. For audited compliance environments, the network tab proves zero outbound calls.
When to format JSON
Whenever you read, debug, diff, or hand-edit JSON. Here are the scenarios where formatting pays off the most.
Reading API responses
Curl prints minified bodies. Paste them in to see structure, find fields, and spot anomalies — without writing a one-off jq command.
10× faster to scanCode review diffs
Sort keys and pretty-print before committing JSON fixtures. Reviewers see real changes, not whitespace and order noise. Pairs perfectly with git diff --word-diff.
Hand-editing config files
Editing package.json, tsconfig.json, composer.json, or AWS policies by hand is much safer when whitespace is consistent and errors surface inline.
Validating before sending
Catch malformed bodies before they hit production. Strict RFC 8259 parse catches trailing commas, control characters, and unterminated strings.
fewer 400 errorsCanonical signatures
Sort keys and minify before hashing — JWT, webhook signatures, JSON-LD canonicalization, and Merkle-tree leaves all rely on byte-stable input.
deterministic outputTeaching & screen sharing
Pretty-printed JSON on a 40px monitor row reads far better in a workshop, code-along, or screen-share than a one-line blob.
production-readyFrequently asked questions
Everything about the JSON Formatter.
JSON.parse. Zero outbound requests — open DevTools → Network to verify.Something missing?
Tell us what you need. We ship the top requests every two weeks.