1. Home
  2. Developer
  3. JSON Formatter

JSON Formatter

Format, minify and validate JSON — errors pinpointed by line and column.

Runs in your browser · No upload Works offline
Valid JSON.
Result
{ "orderId": "A-20261005-0012", "customer": { "name": "Jane Doe", "email": "jane@example.com", "vip": true }, "items": [ { "sku": "TS-BLK-M", "name": "T-shirt", "qty": 2, "price": 19.9 }, { "sku": "CAP-01", "name": "Baseball cap", "qty": 1, "price": 15 } ], "total": 54.8, "paidAt": "2026-10-05T09:30:00-04:00", "coupon": null }
Keys
17
Max depth
3
Input size
287 B
Output size
420 B

Your JSON is processed in this browser only and is never uploaded.

How to use

  1. Paste JSON into the input box — an API response, a config file, a single log line.
  2. Beautify adds line breaks and indentation (2 spaces, 4 spaces or a tab). Minify strips every optional space and line break.
  3. If the syntax is wrong, you get the line and column of the first error, a plain-English cause, and the offending character highlighted.
  4. 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.
  5. Copy the result or download it as a .json file.

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 12345678901234567890 comes back as 12345678901234567000. 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.

Coming soon

Can't find the tool you need?

Tell us what you want to do. We build the most requested tools first.