How to use the JSON validator
- Paste the text into the JSON box.
- The result appears as you type: a green “Valid JSON” message, or the error with its line and column.
- For invalid JSON, look at the code frame: the line is shown with a marker under the exact character.
- For valid JSON, read any yellow warnings, then the stats: Size, Max depth, Keys and Values.
What it does and when to use it
Use the validator when an app rejects a config file, an API returns “unexpected token”, or you have hand-edited a package.json, a translation file or test data and want to be sure it still parses. It answers the yes-or-no question quickly and, when the answer is no, explains the problem in words rather than a cryptic parser message.
Error messages are the same in every browser, because they come from the site’s own scanner rather than the browser’s built-in message, which varies.
Once your data is valid, the JSON formatter makes it readable, and the JSON to TypeScript converter can generate types from it. If the JSON came from a hand-written file full of comments and trailing commas, try the JSON repair tool first.
How it works
- The text is parsed with the browser’s
JSON.parse. A byte-order mark at the start is ignored. - If parsing fails, a strict scanner follows the JSON grammar in RFC 8259 character by character until it reaches the first thing that breaks the rules. It then names the problem (for example “Trailing comma”, “Missing comma between properties” or an unclosed bracket, pointing back to where it opened) and reports its line and column.
- If parsing succeeds, the scanner runs again to look for duplicate keys and for integers beyond 2^53, which
JSON.parseaccepts silently. - Finally the tool counts the size in bytes, the deepest level of nesting, the number of keys and the number of plain values.
Worked examples
These results come from the validator.
A missing comma.
{
"a": 1
"b": 2
}
gives “Invalid JSON — line 3, column 3: Missing comma between properties.” The comma belongs at the end of line 2, but the scanner reports where it found "b" instead.
Valid, with warnings. {"id": 12345678901234567890, "a": 1, "a": 2} is valid, but the tool warns: “Duplicate key: a (line 1). Parsers keep only the last value.” It also flags 12345678901234567890 as a number that loses precision in JavaScript.
A nested object. {"ok": true, "items": [1, 2, {"x": null}]} is valid with Max depth: 3, 3 keys and 4 values.
Limits and tips
- The first error only. Fix it and the next one, if any, appears.
- JSON5 and JSONC (JSON with comments) are not accepted, since they are different formats.
- An empty box is not an error; the tool simply asks for input.
- A lone value such as
42or"hello"is valid JSON. The tool tells you what type the root is.
Frequently asked questions
What makes JSON invalid?
Are duplicate keys an error?
Why does it warn about large numbers?
Does it check my JSON against a schema?
Is the JSON I paste kept private?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.