Skip to content

JSON Validator

Check whether a JSON document is valid and see exactly where it breaks.

Updated · Examples checked by automated tests

LOCAL WORKSPACENO UPLOAD REQUIRED

Paste a document above. Nothing is sent anywhere — validation uses your browser's own JSON parser.

About JSON Validator

A validator answers one question quickly: is this document parseable JSON, and if not, where does it go wrong? Rather than guessing at an error such as "unexpected token", this tool maps the failure back to a line and column and shows the surrounding text.

It also reports useful statistics about a valid document - total keys, maximum nesting depth and size - which is handy when auditing an API response.

How JSON Validator works in your browser

Validation uses the browser’s native JSON parser, which follows ECMA-404 and RFC 8259 exactly. When a document fails, the parser’s error position is mapped back to a line and column and the surrounding text is shown, so you can see the character that broke it.

For a valid document the tool also reports total keys, maximum nesting depth and size. It checks syntax only — validating against a JSON Schema is a separate problem.

When to use it

  • Finding the exact position of a trailing comma or missing quote in a config file.
  • Confirming an API response is valid JSON before debugging your parser.
  • Checking nesting depth and size when auditing a large payload.

Worked examples

Confirm a config file is valid

Settings: Default

Input

{"server":{"port":8080,"hosts":["a","b"]},"debug":false}

Expected output

Valid JSON
Keys: 4
Objects: 2
Arrays: 1
Max depth: 4

Keys counts every object member at every level: server, port, hosts and debug. Max depth counts each level down to the innermost values: the root, server, hosts and the strings inside it.

Locate a trailing comma

Settings: Default

Input

{
  "port": 8080,
  "debug": false,
}

Expected output

Invalid JSON
First problem at line 4, column 1

The error is reported where the parser gave up, which is the closing brace after the stray comma. The wording of the message comes from your browser and differs between Chrome, Firefox and Safari; the line and column do not.

Limits and checks before you use the result

  • Validation checks syntax only. It does not check a JSON Schema, required fields or value types.
  • Only the first error is reported, because a parser cannot reliably continue past it. Fix it and validate again.
  • Duplicate keys are valid JSON syntax and are not flagged, although many parsers keep only the last one.

Frequently asked questions

Which JSON specification is used?

The validator uses the browser native JSON parser, which implements ECMA-404 / RFC 8259. Trailing commas, comments and single quotes are rejected.

Does it validate against a schema?

No. It validates syntax only. JSON Schema validation is a different problem and is not covered by this tool.

What do the line and column mean?

They give the position of the first character the parser could not accept, counted from the start of your document.

Guides

Related tools