Skip to main content
ToolsBay

JSON Validator

Check JSON for syntax errors and see exactly where they are.

Runs entirely in your browser — nothing is uploaded

1 line

Frequently asked questions

Why is a trailing comma an error?

Because the JSON specification does not allow one. JavaScript object literals do, which is why this is the single most common JSON mistake — the syntax looks identical but the rules differ.

Can I use single quotes for strings?

No. JSON requires double quotes for both keys and string values. {'a': 1} and {a: 1} are both invalid, even though both are fine in JavaScript.

Are comments allowed?

Not in standard JSON. Formats like JSON5 and JSONC (used by VS Code and tsconfig.json) add them, but a strict parser will reject them.

Why does the reported line number sometimes look off?

The parser reports where it gave up, which is not always where the mistake is. A missing closing brace is only detected at the end of the document, so the error points at the last line while the real fix is higher up.

What makes JSON invalid

JSON is a deliberately small format, and almost every error comes from one of a handful of causes. In rough order of frequency: a trailing comma after the last item, single quotes instead of double, unquoted keys, a missing closing brace or bracket, and an unescaped character inside a string.

The overlap with JavaScript is what makes these easy to write. Every one of the first three is legal in a JavaScript object literal. JSON borrowed the syntax but not the leniency.

Reading the error position

A parser reports where it could no longer continue, which is not necessarily where you made the mistake. Forget a closing brace on line 4 of a 400-line document and the error appears on line 400 — that is simply where the input ran out. When the reported position looks wrong, work backwards from it looking for something left unclosed.

Strictly speaking

Valid JSON does not mean correct data. This checks syntax only — that the document parses. Whether it has the fields your API expects is a separate question that needs a schema.

To reformat and inspect a large document, use the JSON formatter. To convert it, see JSON to CSV and JSON to XML. For YAML, use the YAML validator.

All developer tools