Paste JSON to format it with 2 or 4 spaces or tabs, minify it, or explore it as a tree. If it’s broken, you get the line and column of the first mistake and a plain reason.
JSON is stricter than JavaScript. These are the errors people hit most, with what this page says about each one (checked by its own validator):
| JSON | What’s wrong |
|---|---|
{"a": 1,} | A comma before } (trailing commas aren’t allowed in JSON) |
{'a': 1} | Keys need double quotes, not single quotes |
{a: 1} | Expected a key in double quotes, found "a" |
[1, 2 | The text ends before this list is closed with ] |
{"a": undefined} | undefined isn’t allowed in JSON |
{"a": 01} | Numbers can’t start with 0 or have a second decimal point |
{"a": 1} // note | More after the end of the JSON: "/" |
Fix the first error and check again: one missing comma or bracket can make every line after it look wrong.
Format adds line breaks and indents so you can read it; Minify removes every space that isn’t inside a string, for the smallest file. Sort keys orders every object’s keys from A to Z, which makes two versions of a file easier to compare. Tree shows the structure: tap any key to see its path, then Query it.
Type a path in the query box to pull out just the part you need. A path starts at $ (the whole document):
| Path | Means |
|---|---|
$.order.id | the id inside order |
$.items[0] | the first item |
$.items[-1] | the last item |
$.items[*].sku | the sku of every item |
$..price | every price, at any depth |
$.items[0:2] | the first two items |
No. It’s formatted and checked in your browser, on your device. Nothing you paste is sent anywhere, so it’s safe for API responses and config files with private data.
Tens of megabytes work in a desktop browser. The tree shows 200 items at a time in long lists, with a button for more, so big files stay quick.
JSON doesn’t allow a comma after the last item in an object or list, though JavaScript does. Delete the comma before the } or ].
No: it points to the exact line and column and says what’s wrong, so you can fix it knowing what changed.
Open all 35 Dev Tools. Everything runs in your browser; nothing you paste is uploaded.