JSON formatter and validator

Paste JSON to format and check it. The gray text is an example.

Formatted
{
  "id": 1042,
  "name": "Ada Lovelace",
  "active": true,
  "roles": [
    "admin",
    "editor"
  ],
  "address": {
    "city": "London",
    "zip": null
  }
}

Example: object with 5 keys, 13 lines. Paste or type JSON, or open or drop a file.

Options

Good to know

Exact values
Numbers and text are printed exactly as written. 12345678901234567890 stays as it is (JavaScript's JSON.parse rounds it to 12345678901234567000), 1.10 keeps its zero and \u00e9 stays escaped.
Errors
The first problem is named with its line and column, for example a missing comma, a key without double quotes or a bracket that is never closed. Click the line number to jump to it.
Fixing mistakes
With “Fix common mistakes” on, comments, trailing commas, single quotes and unquoted keys (habits from JavaScript and JSON5) are fixed in the output, and the line under the boxes says what changed. Missing commas and values such as undefined are not guessed.
Duplicate keys
JSON allows the same key twice, but most programs keep only the last value. Both are kept here, and the first duplicate is pointed out.
Minify and sort
Choose Minified to remove every space and line break outside strings. Sort keys orders the keys at every level by character code, so capital letters come before lowercase ones.
JSON Lines
A file with one JSON value per line is not a single JSON document. To turn it into rows, use JSON to CSV.
Open from a link
?input={"a":1} opens the page with that JSON; add &indent=4, tab or min, and &sort=1. Write a + in the JSON as %2B, or it arrives as a space.