JSON validator — check JSON syntax and find the exact error

Paste JSON to find out at once whether it is valid; if not, you get the line, column and a plain-English reason, and if it is, you get warnings about duplicate keys and numbers too large for JavaScript.

Live demo · real result from this tool

Valid JSON — the root is an object.

StatusValid
Size
195 B
Max depth
2
Keys
9
Values
9

Processed on your device — nothing is uploaded.

How to use the JSON validator

  1. Paste the text into the JSON box.
  2. The result appears as you type: a green “Valid JSON” message, or the error with its line and column.
  3. For invalid JSON, look at the code frame: the line is shown with a marker under the exact character.
  4. 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

  1. The text is parsed with the browser’s JSON.parse. A byte-order mark at the start is ignored.
  2. 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.
  3. If parsing succeeds, the scanner runs again to look for duplicate keys and for integers beyond 2^53, which JSON.parse accepts silently.
  4. 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 42 or "hello" is valid JSON. The tool tells you what type the root is.

Frequently asked questions

What makes JSON invalid?
Common causes are a comma after the last item, a missing comma between items, single quotes, keys without quotes, comments, and JavaScript values such as undefined, NaN or Infinity. Python's True, False and None are not JSON either; JSON uses true, false and null.
Are duplicate keys an error?
The JSON standard says keys should be unique but does not forbid duplicates, so the text still counts as valid. In practice most parsers keep only the last value and silently drop the others, so the validator warns you and gives the line.
Why does it warn about large numbers?
JavaScript stores numbers as 64-bit floating point, which is exact only for whole numbers up to 2^53, about 9 quadrillion. Bigger IDs, such as some database or social-media IDs, get rounded when read in a browser. Sending them as strings avoids this.
Does it check my JSON against a schema?
No. It checks syntax only. To check that data has the right fields and types, use the JSON schema validator.
Is the JSON I paste kept private?
Yes. Validation runs in your browser and the text is never uploaded.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close