About the JSON Formatter
This takes raw, messy JSON — a single-line API response, a minified config, or something you've hand-edited — and pretty-prints it into clean, indented, readable form. It also works in reverse, minifying JSON down to the smallest single line, and validates as it goes, so it doubles as a quick syntax checker. It's a daily tool for developers reading API payloads, anyone editing a package.json or config file, and QA or support staff trying to make sense of a log line full of JSON.
How it works
It runs your text through the browser's native JSON.parse, then re-serialises it:
- Format uses
JSON.stringifywith your chosen indent — 2 spaces, 4 spaces, or a tab. - Minify uses
JSON.stringifywith no whitespace, producing the most compact valid JSON. - Validate happens automatically: if
JSON.parsefails, you get the exact error message (and position) the parser reports, so you can find the stray comma or bracket.
Because it parses then re-prints, the output is always canonical, correctly-escaped JSON.
Assumptions and behaviour
- It expects strict, standard JSON. Double-quoted keys, no trailing commas, no comments.
- Key order is preserved as written; it doesn't sort or reorder object keys.
- Duplicate keys collapse to the last one, because that's how
JSON.parseresolves them — the earlier value is silently dropped. - Whitespace and your original line breaks inside the source are discarded; only the data structure is kept and re-formatted.
Limitations
- It's strict JSON, not JSON5 or JavaScript. Comments (
//), trailing commas, single quotes, and unquoted keys are all rejected as invalid — even though some editors accept them. - Very large numbers lose precision. JSON numbers are parsed into JavaScript's floating-point numbers, so integers beyond about 9 quadrillion (2⁵³) or high-precision decimals can be rounded. If you have big IDs, keep them as strings.
- It formats a single JSON document, not newline-delimited JSON (NDJSON) or multiple concatenated objects.
- Extremely large documents are bound by your device's memory, since everything is processed in the browser.
Privacy
Your JSON is parsed and formatted entirely in your browser with the built-in JSON engine. Nothing is uploaded, logged, or stored.

