/tools/json-validator

JSON Validator

Paste a document and find out whether it parses. Failures come with a line, a column and the offending snippet, so you can fix the cause rather than hunt for it.

JSON ValidatorRuns in your browser

How to use the JSON Validator

  1. Paste the JSON you want to check into the box.
  2. Press Validate. A green result means the document parses cleanly.
  3. If it fails, read the caret line under the snippet — it marks the exact column where the parser stopped.

What "valid JSON" means

JSON is defined by a short specification (RFC 8259). A valid document is exactly one value: an object, an array, a string, a number, true, false or null. Anything else — two objects side by side, a stray comma, a comment — is invalid, no matter how readable it looks.

Validation here means syntactic validation. This tool answers "will a parser accept this?" It does not answer "does this match my schema?" A document can be perfectly valid JSON and still be missing every field your API requires.

The five rules that catch most people

  • Double quotes only. Both keys and string values need them. {'a': 1} is invalid.
  • Keys must be quoted. {a: 1} is a JavaScript object literal, not JSON.
  • No trailing commas. [1, 2, 3,] fails.
  • No comments. Strip // and /* */ before validating.
  • Numbers are plain. No leading zeros, no + prefix, no NaN, no Infinity, no hex.

Reading the error position

The reported column is where the parser encountered something it could not use — not necessarily where you made the mistake. A missing comma on line 8 is usually reported at the start of line 9, because the parser only notices when it sees a key where it expected a separator. Always check the line above the one flagged.

Frequently asked questions

Does a valid result mean my API will accept it?

It means the syntax is correct. Whether the fields, types and values match what a particular endpoint expects is schema validation, which is a separate step.

Why is an empty string invalid?

A JSON document must contain exactly one value. Empty input contains none, so parsers reject it. If you mean "no data", use null or {}.

Is JSONL or NDJSON valid here?

No. Newline-delimited JSON is many documents in one file. Each line is valid on its own, but the file as a whole is not a single JSON value. Validate one line at a time.

Can I validate a file instead of pasting?

Open the file in any text editor and paste its contents. Keeping the tool paste-only means nothing ever leaves your machine.

Related tools