How to use
- Paste JSON into the input box — an API response, a config file, a single log line.
- Beautify adds line breaks and indentation (2 spaces, 4 spaces or a tab). Minify strips every optional space and line break.
- If the syntax is wrong, you get the line and column of the first error, a plain-English cause, and the offending character highlighted.
- Turn on Sort keys A→Z to order object keys alphabetically at every depth. Do this before comparing two documents in Text Diff so 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 is 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 are not 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, which is why the previous line is shown alongside the error.
Example
Beautifying {"name":"Jane","tags":["vip","new"]} with 2 spaces gives 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 exact only 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 such IDs as strings. - Duplicate keys keep the last value. The JSON spec leaves duplicates undefined, and browsers keep the last one.
- A leading byte order mark (U+FEFF) 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. It’s safe for responses that contain tokens or personal data. For JWTs, the JWT Decoder is more convenient.
How is “max depth” counted?
A plain value (number, string) is 0, a single object or array is 1, and each nested object or array adds one.
Tabs or spaces?
There’s 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.