How to use
- Paste JSON into the input box: an API response, a config file or a single log line.
- Beautify adds line breaks and indentation (2 spaces, 4 spaces or a tab). Minify strips out every optional space and line break.
- If the syntax is wrong, you’ll see the line and column of the first error, a plain-English explanation and the problem character highlighted.
- Turn on Sort keys A→Z to put object keys in alphabetical order at every level. Do this before comparing two documents in Text Diff, so a different key order doesn’t show up as a change.
- Copy the result or download it as a
.jsonfile.
Common JSON errors
JSON is defined by RFC 8259 (ECMA-404), and it’s stricter than JavaScript object syntax.
| Error | Wrong | Right |
|---|---|---|
| Trailing comma | {"a": 1,} |
{"a": 1} |
| Single quotes | {'a': 'x'} |
{"a": "x"} |
| Unquoted key | {a: 1} |
{"a": 1} |
| Comment | {"a": 1 // note} |
Comments aren’t allowed |
| Missing comma | {"a": 1 "b": 2} |
{"a": 1, "b": 2} |
| Raw line break in a string | "line one(Enter)line two" |
"line one\nline two" |
| Leading zero | {"zip": 01234} |
{"zip": "01234"} |
undefined or NaN |
{"a": NaN} |
{"a": null} |
A “comma expected” error usually means the comma is missing at the end of the previous line. That’s why the previous line is shown along with the error.
Example
Beautifying {"name":"Jane","tags":["vip","new"]} with 2 spaces gives you 7 lines, 2 keys (name, tags) and a max depth of 2. Minified, the same data is 36 bytes.
Things to watch out for
- Large integers lose their last digits. JavaScript numbers are only exact up to 2^53−1 (9,007,199,254,740,991), so an ID like
12345678901234567890comes back as12345678901234567000. The tool warns you when this happens. Send IDs like these as strings. - Duplicate keys keep the last value. The JSON spec doesn’t define what happens with duplicate keys, and browsers keep the last one.
- A byte order mark (U+FEFF) at the start is ignored automatically.
FAQ
Is my JSON uploaded anywhere?
No. Parsing and formatting use your browser’s built-in JSON.parse and JSON.stringify, and no network request is made, so it’s safe to use with responses that contain tokens or personal data. For JWTs, the JWT Decoder is more convenient.
How is “max depth” counted?
A plain value (a number or string) is 0, a single object or array is 1, and each nested object or array adds one.
Should I indent with tabs or spaces?
It makes no functional difference. Two spaces is the most common choice in web projects, while Python’s json.dumps(indent=4) uses four. Follow your team’s style guide.