Category: Developer

JSON Validator

Check whether JSON is valid and find the exact error.

Runs in your browserProcessed locally. Your input never leaves your device.

Details

About this tool

Checks whether JSON is valid and, when it is not, points at the exact line and column where parsing stopped with a plain explanation of what was expected there.

JSON is a small format with strict rules, and almost every failure comes from a handful of them. Keys must be in double quotes - single quotes are not JSON, however much they look like it. A trailing comma after the last item in an object or array is a syntax error, even though JavaScript itself allows one. Comments are not part of the format at all. NaN and Infinity are not valid numbers, and neither is a leading zero or a leading plus. And an unescaped newline inside a string ends the string rather than continuing it.

The position matters as much as the message, because a parser reports where it gave up rather than where the mistake is. A missing closing brace is discovered at the end of the file, and an unclosed string swallows everything after it until the next quote - so the line the error names is often the symptom, and the cause is above it. Knowing that turns a confusing error into a search with a direction.

This checks syntax, not meaning: it will tell you a document parses, not that it has the fields your API requires or that the types are right. That is schema validation, a separate job. If you want the document reformatted rather than checked, the JSON formatter does that, and it reports the same errors. Everything runs in your browser, which matters when the payload is a real API response with real data in it.

Keep going

  • Format, indent and beautify JSON.

    Runs in your browserDeveloper
  • Inspect the header and payload of a JSON Web Token.

    Runs in your browserDeveloper

Good to know

Questions people actually ask

Does this validate against a JSON Schema?
Not yet. This checks syntax only - whether the document parses. Whether it has the required fields, in the right types, is schema validation, and it is planned as a separate tool so that the two are never confused for one another.
Why is my trailing comma an error?
Because JSON does not allow one, even though JavaScript, Python and most languages do. It is the single most common JSON syntax error. Some parsers accept it as an extension, which makes it worse: the file works in one place and fails in another.
Can I use single quotes or comments?
No to both. JSON requires double quotes around every string and every key, and it has no comment syntax at all. Formats such as JSON5 and JSONC add both, and configuration files often use them, but a strict parser will reject that content as invalid JSON.
The error points at a line that looks fine. Why?
Because a parser reports where it could no longer continue, not where the mistake was made. An unclosed string or a missing brace is only noticed later - sometimes at the very end of the file - so the real cause is usually above the line named. Start there and read upwards.