1. Home
  2. Developer
  3. JSON Formatter

JSON Formatter

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

For every format and option in one place, use Code Formatter and Checker →

Runs in your browser · No upload
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 or a single log line.
  2. Beautify adds line breaks and indentation (2 spaces, 4 spaces or a tab). Minify strips out every optional space and line break.
  3. 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.
  4. 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.
  5. Copy the result or download it as a .json file.

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

Can't find the tool you need?

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