Tools
JSON Beautifier and Minifier
Pretty-print and validate JSON instantly, or compress it to a single line for transport. Invalid JSON is flagged inline as you type — no API roundtrip, everything runs in your browser.
About the JSON Beautifier / Validator
JSON Beautifier / Validator takes JSON you paste into the source pane and either pretty-prints it with a configurable indent (0-8 spaces) or collapses it to one minified line. Validity is re-checked on every keystroke, independent of clicking anything: a Valid JSON / Invalid JSON badge in the toolbar updates live, and the Beautify and Minify buttons stay disabled until the input parses cleanly. When parsing fails, the exact error text — including the character position and line/column — appears in a red banner under the toolbar, so you can jump straight to the broken token instead of scanning the whole payload by eye.
There is no custom JSON parser under the hood. Beautify runs JSON.stringify(JSON.parse(source), null, indent); Minify runs the same JSON.parse but calls JSON.stringify(value) with no indent argument at all. Both editor panes are CodeMirror instances with JSON syntax highlighting, not plain textarea elements, and the component is a client component end to end — no network request fires when you click either button. That matters for real API responses or config files that include tokens or user data: nothing you paste here ever leaves your browser.
Reach for it when you're staring at a minified response in a browser's network tab, cleaning up a .json file before a commit, or checking hand-edited JSON before it goes into a request body. Setting indent to 0 makes Beautify produce the same output as Minify — both strip all insignificant whitespace, they just get there through different code paths. Copy puts the result on your clipboard and Clear resets both panes; neither button touches the JSON's actual values, only its formatting.
Examples
Input:
{"id":42,"name":"Ada Lovelace","roles":["admin","editor"],"active":true,"meta":null}
Output (indent = 2):
{
"id": 42,
"name": "Ada Lovelace",
"roles": [
"admin",
"editor"
],
"active": true,
"meta": null
}Verified: JSON.stringify(JSON.parse(input), null, 2) produces this exact output — 2 is the tool's default indent value.
Input:
{
"hello": "world",
"items": [1, 2, 3]
}
Output:
{"hello":"world","items":[1,2,3]}This is the source pane's default text — open /tools/json-beautify and click Minify without editing anything to reproduce this exact output.
Input:
{
"id": 1,
"name": "Ada",
}
Validity badge: Invalid JSON
Error shown: Expected double-quoted property name in JSON at position 30 (line 4 column 1)Error wording comes verbatim from JSON.parse and is engine-specific — Chromium-based browsers show this exact text; Firefox and Safari phrase it differently but flag the same trailing comma.
Frequently asked questions
Why does the tool say my JSON is invalid when it looks fine?
The most common causes are a trailing comma after the last item, single quotes instead of double quotes around strings, unquoted object keys, or a // comment — all valid in a JavaScript object literal but not in JSON. Check the exact position named in the red error banner; it points at the first token JSON.parse couldn't make sense of.
Does JSON.parse check that my data has the right structure, or just the syntax?
Just the syntax. JSON.parse happily accepts {"age": "twelve"} even if your code expects age to be a number, because that's still well-formed JSON. For structural or type checks you need a JSON Schema validator, not a beautifier.
Is it safe to paste an API response with real user data or tokens into this tool?
Yes. Parsing and formatting both happen via JSON.parse/JSON.stringify in your browser's own JavaScript engine, and the component never issues a network request with your input. It exists only in that tab's memory and is gone on refresh.
What's the actual difference between Beautify and Minify?
Beautify re-serializes with JSON.stringify(value, null, indent), adding newlines and the number of spaces set in the Indent field; Minify calls JSON.stringify(value) with no indent argument, producing the shortest valid representation on one line. Neither changes any keys, values, or types — only whitespace.
Can this tool fix broken JSON for me automatically?
No. Beautify and Minify are both disabled while the input fails to parse, so the tool never guesses at a fix — you correct the syntax error yourself using the position shown in the error banner, and both buttons re-enable once it parses.