The origin of JSON: the story behind the format
Follow JSON from a small browser messaging idea to the language-independent standard behind modern APIs.
Guide
Readable JSON is easier to review, debug and share. Validation comes first, because a formatter cannot reliably interpret a document that is not valid JSON.
JSON has a small set of rules. An object uses double-quoted keys, a colon between each key and value, and commas between members. Arrays use square brackets. Strings use double quotes. The values can be strings, numbers, booleans, null, objects or arrays.
{
"name": "Ada",
"active": true,
"roles": ["admin", "reviewer"]
}Single quotes, comments, trailing commas and unquoted keys are common in JavaScript, but they are not part of standard JSON. A strict parser reports them as errors. If you received a loose JSON-like file, Tool Kumar can identify common mistakes and offer a repair action while keeping the original input available.
Error positions point to where the parser stopped. That is not always where the mistake began. In this document the comma is missing at the end of line 2, but the parser reports line 3, because the next key is where it can no longer continue:
{
"name": "Ada"
"active": true
}Use pretty-printed JSON when someone needs to inspect or review a file. Keep indentation consistent, put one member on each line and preserve meaningful key order. Use minified JSON for a transport step when size matters and whitespace has no value.
Formatting does not change the data. It only changes whitespace. A good JSON formatter should also preserve large numbers, report invalid syntax clearly and avoid sending private documents to a remote service. Tool Kumar formats and validates JSON in your browser, so the input stays on your device.
| Mistake | Example | Fix |
|---|---|---|
| Trailing comma | [1, 2,] | Remove the comma after the last object member or array item. |
| Single quotes | {'id': 1} | Use double quotes for strings and escape any inner double quotes. |
| Unquoted key | {id: 1} | Write object keys as strings, such as "id". |
| Missing value | {"id": } | Give every key a value after its colon. |
| Unclosed object or array | {"ids": [1, 2} | Match every opening brace or bracket with a closing one. |
| Invalid number | NaN, Infinity, 012 | JSON has no special numbers or leading zeroes. Use a plain number, a string or null. |
Every one of these can be checked in the free JSON viewer and formatter: it points to the line and column of the first error and offers to repair the common ones for you.