JSON Formatter
Paste JSON, get a clean indented copy. Pick indent size (2, 4, or tab), optionally sort keys recursively for stable diffs, and copy or download the result. Strict RFC 8259 parsing — errors highlight the exact line and column. Nothing leaves your browser.
How to format JSON
- Paste your JSON into the input panel (or drop a
.jsonfile). Validation is live — errors highlight as you type. - Pick Indent — 2 spaces (default), 4 spaces, Tab, or Minify (no whitespace).
- Toggle Sort keys if you want alphabetical ordering applied recursively (helps with stable diffs).
- The output appears in the right-hand panel. Copy copies, Download saves as
.json. - The status bar shows input size, output size, and key / array / depth counts.
Common pitfalls
- Trailing commas — JSON forbids them. The error message shows the exact line and column.
- Single quotes / unquoted keys — also forbidden. If your input has many issues, try json-repair first.
- Smart quotes (curly
“ ”from word processors) — JSON requires straight". json-repair fixes them. - Numbers with leading zeros (
0123) — invalid JSON. Either quote them or strip the leading zero.
FAQ
What is the difference between formatter and minifier?
Formatter adds whitespace to make JSON readable; minifier strips it to make JSON small. Use formatter for humans, minifier for transport.
Why does sorting keys help with diffs?
If two API consumers serialize the same object with different key order, a diff tool reports them as different. Sorting both first normalises the order; the diff then shows only real differences. The JSON diff tool also has an Ignore key order toggle.
Will it work offline?
Yes. After the page loads once, the JSON formatter is plain JavaScript — disconnect and it still works.
Is there a file size limit?
Bounded by your browser's memory (typically 100 MB+ before things slow down). Very large documents (>50 MB) may make the textarea sluggish — drop the file instead of pasting.