How to use the json validator
- Paste JSON or open a .json file. Validation runs as you type.
- If there is a syntax error, read the line, column and the highlighted snippet with a caret under the problem.
- Keep "Treat duplicate keys as errors" on to flag repeated keys in the same object, with their paths and positions.
- Review the stats (keys, objects, arrays, depth) and copy a text report if you need to share it.
Worked example
A duplicated "id" key
The sample input has "id": 42 and later "id": 43 in the same object. JSON.parse accepts it and keeps 43. The validator reports the syntax as valid but flags the duplicate key "id" in $ at line 6, column 3, and counts 7 keys, 2 objects, 1 array and a maximum depth of 2.
How it works
A small tokenizer and recursive descent parser follows the RFC 8259 grammar exactly: whitespace, objects, arrays, strings with escapes, numbers, true, false and null. It records the offset of the first error and converts it to a line and column (CRLF counts as one line break). For each object it keeps a set of decoded key names, so "a" and "\u0061" are recognised as the same key.
Frequently asked questions
Is my data uploaded?
No. This tool runs entirely in your browser. Your input is processed on your device and is not sent to our server or stored.
Are duplicate keys invalid JSON?
RFC 8259 says object names SHOULD be unique, not MUST, so most parsers accept duplicates. Behaviour then differs between parsers (first value, last value or an error), which is why duplicates cause real bugs. The toggle lets you treat them as errors.
Why is my JSON from JavaScript code rejected?
JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. JSON does not. The error message names the specific problem and its position.
Does it validate against a JSON Schema?
No. It checks syntax and structure only. It does not check that fields have the types or values a schema requires.
Limitations
- Syntax validation only; no JSON Schema support.
- Stops at the first syntax error, as JSON parsers do.
- Nesting deeper than 2,000 levels is reported as an error.