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
JSON to validate
Report
The validation report appears here.How to use JSON Validator
- Paste your JSON into the left panel, or press Example to load a document with a typical mistake.
- 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.
- 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.
- 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.
{
"name": "codevory",
"tools": ["json", "yaml",],
"private": true
}Invalid JSON · line 3, column 27: Trailing comma before ']' is not allowed in JSON.
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
| Rule | Valid | Not 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.
More developer tools
- { }JSON Formatter & ValidatorFormat, validate and minify JSON. Errors point to the exact line and column, and nothing you paste leaves your browser.
- {}JSON MinifierRemove every optional space and line break from JSON to make it as small as possible, without changing a single value.
- →csvJSON to CSV ConverterConvert a JSON array of objects to CSV. Nested objects and arrays are spread into columns, and every cell is quoted correctly.
- yml→YAML to JSON ConverterConvert YAML to JSON, resolving anchors, aliases and merge keys. Big integers stay exact and key order is preserved.