Skip to content
codevory

JSON Validator

Check JSON against the specification and get the exact line and column of the first error, plus a summary of what the document contains.

JSON Validator: the tool

Paste JSON to check it against the JSON specification.

JSON to validate

Report

The validation report appears here.

How to use JSON Validator

  1. Paste your JSON into the left panel, or press Example to load a document with a typical mistake.
  2. If it is valid, the right panel reports the root type, nesting depth and how many objects, arrays, strings, numbers, booleans and nulls it holds.
  3. If it is not, the status bar names the problem with its line and column. Press Go to error to jump to it and fix it.
  4. Duplicate keys are reported as warnings, because they are legal JSON that most parsers handle in surprising ways.

Example

The same document with and without the mistake. The comma after "yaml" is not allowed in JSON.

Invalid input
{
  "name": "codevory",
  "tools": ["json", "yaml",],
  "private": true
}
Result
Invalid JSON · line 3, column 27: Trailing comma before ']' is not allowed in JSON.
Report for a valid document
Result          Valid JSON (RFC 8259)
Root            object with 5 properties
Nesting depth   2
Objects         2
Arrays          1
Strings         3
Numbers         1
Booleans        1
Nulls           1
Distinct names  6
Size            93 B as UTF-8

About this tool

A validator answers one question: will every JSON parser accept this text? This one follows RFC 8259 strictly, which is the behaviour of JSON.parse, of API servers and of configuration loaders. That means no comments, no trailing commas, no single quotes, no unquoted property names and no values such as NaN or undefined.

Error messages describe the cause rather than just the symptom: a trailing comma, a missing comma between two items, an unclosed string, a number with a leading zero. The position points at the first place where the text stops being valid, which is where you should start looking, even if the real mistake is slightly earlier.

Validation here means syntax. The tool does not check your data against a JSON Schema, so a document with a wrong type or a missing field is still valid JSON. Everything runs in your browser and nothing you paste is uploaded.

What is valid JSON

RuleValidNot valid
Strings use double quotes{"a": "b"}{'a': 'b'}
Property names are quoted{"a": 1}{a: 1}
No trailing commas[1, 2][1, 2,]
No comments{"a": 1}{"a": 1} // note
Numbers have no leading zeros or +[7, -0.5, 1e3][007, +1, .5]
Only true, false and null[true, null][True, undefined, NaN]

Frequently asked questions

What is the difference between a JSON validator and a JSON formatter?

Both parse the text with the same strict rules. A formatter focuses on rewriting it with new indentation, while the validator focuses on telling you whether it is valid and what it contains. If you also want the pretty-printed text, use the JSON formatter.

Why is my JSON valid in JavaScript but rejected here?

JavaScript object literals allow trailing commas, single quotes, unquoted keys and comments. JSON does not. Parsers, APIs and configuration loaders apply the stricter JSON rules, which is what this tool checks.

Does the validator support JSON5 or JSON with comments?

No. JSON5 and JSONC are different formats. Comments are reported with a message that says so, so you can remove them or choose a tool that expects those formats.

Why are duplicate keys only a warning?

The grammar allows an object to repeat a name, so the document is syntactically valid. Parsers disagree about what to do, and most keep the last value. The warning points at each repeated key so you can decide which one is right.

Does it validate against a JSON Schema?

No. It checks syntax only. A document can be valid JSON and still be wrong for your API, for example a string where a number is expected.

Is my data uploaded?

No. Parsing happens in your browser tab and nothing is sent to a server.