Skip to content
GivenTool

Validate JSON and locate the error

Check whether text is valid JSON and see exactly where it breaks, with line, column and a caret.

0 / 2,000,000 characters · Updates as you type.

Runs in your browser. Nothing you type is sent anywhere.

A missing comma at line 412 of a config file can cost half an hour if the only message you get is "Unexpected token". This validator parses the text with the same rules as JSON.parse and, when that fails, re-scans it with a small parser whose only job is to find the first offending character and explain it: a trailing comma, a single-quoted string, an unescaped line break, a bare word.

The message names the line and column (1-based, the way editors count) and prints the line with a caret underneath. Fix that one place and validate again; JSON errors are almost always sequential, so the next problem, if any, will be reported next.

When the document is valid the tool reports its top-level type and size, which is a quick way to check that an API returned an array rather than an object, or that a file is not empty.

How to use it

  1. Paste the text you want to check. Validation runs as you type.
  2. Read the result: either "Valid JSON" with the top-level type, or an error with line, column and a caret excerpt.
  3. Fix the reported character and check again until the document is valid.
  4. Switch to the JSON formatter (linked below) to pretty-print the valid result.

Frequently asked questions

What is the difference between this and the JSON formatter?

Both use the same parser and report the same errors. The validator stops there and tells you the type and size; the formatter also rewrites the document with your chosen indentation.

Does it validate against a JSON Schema?

No. It checks syntax only: whether the text is well-formed JSON. Schema validation (required fields, types) needs a schema document and is a different task.

Why does the position differ from my editor by one?

Both count from 1, but tabs are counted as one column here while some editors expand them to 4 or 8. Line numbers always match.

Can it find more than one error at a time?

It reports the first error only. Once a JSON parser hits an invalid character it cannot reliably resynchronise, so any further "errors" would be guesses.