About the JSON Validator
A validator answers one question: is this text JSON? This tool uses a strict parser written to RFC 8259, so it rejects the things JavaScript would quietly accept, such as single quotes, trailing commas, comments, NaN, hexadecimal numbers and unquoted keys. When the input is valid you get a summary: the root type, and the number of objects, arrays, keys and primitive values, plus the maximum nesting depth.
When it is not valid, the message names the line and column and describes the problem in plain words: "expected , or } but found 'x'", "unterminated string", "trailing comma before ]". The same spot is highlighted in the editor. Because the parser stops at the first error, fix it and validate again to find the next one; most files have only one or two.
The validator is deliberately strict. Many tools accept "JSON5" or JavaScript object syntax, which then fails in a production parser. If you want lenient parsing with automatic repair, that is what the JSON Fixer is for.
How to use
- Paste the JSON to check, or use Upload for a file.
- Read the result on the right. Valid input shows a short structure summary.
- For invalid input, jump to the reported line and column in the left pane, correct it, and the result updates as you type.
Common questions
- Why is my JSON invalid when it works in JavaScript?
- JavaScript object literals allow single quotes, unquoted keys, trailing commas and comments. JSON allows none of these. Paste it into the JSON Fixer to convert it.
- Does the validator check against a JSON Schema?
- No, this tool checks syntax only. Schema validation compares a document to a set of rules about required fields and types, which is a different job.
- Can it validate multiple JSON documents at once?
- One document per run. If you have newline-delimited JSON, the JSON Lines to JSON converter validates each line and reports the failing line number.
- What does "Max depth" mean in the result?
- How many levels of nesting the deepest value sits at. A flat object has depth 2 (the object, then its values). Very deep documents, above about 100 levels, can be a sign of a serialisation bug.