The JSON Formatter pretty-prints minified or messy JSON with 2-space or 4-space indentation, or minifies it back to a single line, and points to the exact line and column of any syntax error. It is meant for developers reading API responses, editing config files, and preparing JSON for a commit or a bug report.
Input
{"name":"Ada","langs":["en","fr"],"active":true}
Output
{ "name": "Ada", "langs": [ "en", "fr" ], "active": true }
Input
{ "id": 7, "tags": [ "a", "b" ] } (Minify)
Output
{"id":7,"tags":["a","b"]}
Input
{"name": "Ada", "roles": ["admin", "editor"],}
Output
Trailing comma before "}". JSON doesn't allow a comma after the last property. Remove it. (line 1, column 46)
Formatting works by parsing the input with the browser's built-in JSON.parse and writing it back out with JSON.stringify at the chosen indent. That round trip is strict: the input must be valid JSON as defined by RFC 8259, so comments, single-quoted strings, unquoted keys, trailing commas, NaN, and undefined are rejected rather than silently fixed. When parsing fails, the tool runs a second, purpose-built parser over the text to find the first error and explain it, because JSON.parse's own messages differ between browsers and are often vague.
Because the output is re-serialized rather than re-indented, a few things can change besides whitespace. Numbers are normalized: 1.50 becomes 1.5 and 1e3 becomes 1000. Escape sequences are decoded, so "\u00e9" is written as é. If an object has the same key twice, only the last value survives. Object keys that look like whole numbers, such as "2" or "10", are moved to the front in ascending order, which is how JavaScript orders integer-like property names. All other keys keep their original order, and nothing is sorted alphabetically.
Integers larger than 9,007,199,254,740,991 (2^53 − 1) cannot be stored exactly in a JavaScript number, so a 64-bit ID such as 12345678901234567890 will come out rounded. If your data contains large IDs, keep them as strings, or check the input with the JSON validator, which warns about unsafe integers and duplicate keys instead of quietly rewriting them.
Two-space indentation is the default in most JavaScript projects and package.json files; four spaces is common in Python and Java codebases. Minify removes every optional space and line break, which is what you want for an environment variable, a URL parameter, or a smaller payload. Everything runs in the page, so pasting a response that contains tokens or customer data does not send it anywhere. To turn an array of records into a spreadsheet, use JSON to CSV.
More Developer Tools