{ } JSON Formatter
Paste JSON, click once. Pretty print or minify — everything runs locally in your browser, nothing is uploaded.
How to use the JSON formatter
- Paste your JSON into the
input.jsonbox on the left. Want to see how it works first? Click Sample to load example data. - Click Format to get neatly indented JSON in the
output.jsonbox. You can also pressCtrl + Enter(⌘ + Enteron a Mac) inside the input box. - Pick
indent: 2,indent: 4orindent: tab. The output re-formats as soon as you change it. - Minify strips every space and line break and squeezes the JSON onto a single line.
- Use Copy output to copy the result and Clear to empty both boxes.
Pretty print vs. minify
Whitespace has no meaning in JSON, so adding or removing line breaks and indentation never changes the data itself. That's why the same payload is usually kept in two shapes depending on who is reading it:
- Pretty printed — for debugging API responses or editing config files by hand. Nesting depth of objects and arrays is visible at a glance.
- Minified — for sending over the network, stuffing into an environment variable, or logging on a single line. No wasted bytes.
| Input | Format (indent 2) | Minify |
|---|---|---|
{ "a" : 1 , "b" : [true,null] } | one key per line, array items on their own lines | {"a":1,"b":[true,null]} |
| an 18 KB pretty-printed API response | unchanged structure, easy to read | typically 20–35% smaller |
The character count of the result is shown under the output, so you can compare sizes before and after minifying.
How it works
The input is read with the browser's built-in JSON.parse and written back out with JSON.stringify. Nothing is sent to a server. If parsing succeeds you'll see ✓ valid JSON; if it fails you get ✗ plus the browser's own error message, so the formatter doubles as a quick syntax check. For an exact line-and-column error location with plain-English hints, use the JSON Validator.
Tips
- Working with JavaScript or most web projects? 2 spaces is the common convention. Python projects (and
json.dumps(indent=4)) usually use 4. - Copying JSON out of a log line that's wrapped in quotes? Strip the outer quotes and unescape
\"first, or the parser will see a single string. - Need to share a config in Slack or a ticket? Format it first — reviewers will thank you.
Because the data is re-serialized, a few things can differ from the original: duplicate keys keep only the last value, numbers like 1.0 become 1, and very large integers (above 253 ≈ 9 quadrillion) lose precision. Comments, single quotes and trailing commas aren't standard JSON, so they're reported as errors.