Free JSON beautifier, validator, and minifier — with tree view, JSONPath copy, auto-repair, and stats. Runs in your browser; payloads stay on your device.
JSON Formatter Features
- Beautify & minify — Format messy single-line JSON into a readable structure, or compress an indented file back into a payload-friendly minified version.
- Validate & auto-repair — Errors point to the exact line + column. The repair button fixes common issues — unquoted keys, single quotes, trailing commas — automatically.
- Sort keys + tree view — Alphabetise every key recursively, switch between text view and an interactive tree view with copyable JSONPath ($.user.name) for any node.
- Configurable output — Pick 2-space, 4-space, or tab indentation. Upload .json files, copy the result, or download as .json — including JSON stats (keys, depth, nesting).
How to Use JSON Formatter
Four steps. No signup, no upload, no payload limits.
- Paste or upload — Drop JSON text into the box or upload a .json file. Files never leave your browser.
- Pick an action — Beautify, Minify, Validate, Sort Keys, or Repair — each runs locally with instant feedback.
- Inspect — Toggle between Text view (with syntax highlighting) and Tree view (clickable JSONPath badges).
- Copy or download — Copy to clipboard or save the formatted output as a .json file.
Frequently Asked Questions
What does Beautify vs Minify do?
Beautify expands JSON into an indented, multi-line structure (great for reading + debugging). Minify removes every unnecessary whitespace character — useful for shipping a smaller payload over the wire. The same parse step is used for both, so invalid JSON gets caught either way.
What does the Repair button fix automatically?
Three common JSON sins: (1) unquoted keys like `{name: "x"}` get quoted, (2) single quotes get swapped for double quotes, (3) trailing commas before `}` or `]` are removed. If the repaired result still doesn't parse, you'll get an error with the exact line and column.
What's the Tree view for?
It shows your JSON as an expand/collapse tree. Hover any node and a small badge shows its JSONPath (e.g. `$.user.address.city`); click the badge to copy. Useful when wiring up jq filters, JSON Schema selectors, or API contract tests.
What stats does the tool show?
After parsing, you see: total keys, max nesting depth, number of objects, and number of arrays. Quick sanity check on large or unfamiliar payloads — useful for spotting unexpectedly deep nesting or oversized arrays.
Can I sort the keys alphabetically?
Yes — Sort Keys recursively alphabetises every object's keys (arrays are kept in their original order). Useful for diffing two JSON payloads when key order varies but content should match.
Is my data uploaded anywhere?
No. Parsing and formatting run via the browser's native JSON.parse() and JSON.stringify(). Your API responses, auth tokens, customer payloads, and config files never leave your device — safe for sensitive data.
Can it handle large JSON files?
Yes — the parser handles multi-MB JSON comfortably on most modern browsers. Tree view is the slowest path (it renders every node); for very large arrays, prefer the Text view with the regex-based syntax highlighting.
What indentation styles are supported?
Three: 2 spaces (default, used by most JS/TS projects), 4 spaces (Python / Java conventions), or tab. The choice applies to Beautify, Sort Keys, and Repair output. Minify ignores indentation entirely.
Related: json formatter, json formatter online, json formatter free, json formatter online free, online json formatter, json beautify, json beautify online, json beautify online free, json beautifier, json beautifier online