JSON Validator
Validate JSON against the RFC 8259 grammar and see the exact line, column and reason of any error, plus duplicate-key warnings and structure stats.
Runs entirely in your browser. Your data is never uploaded.
Related Tools
View AllWhat is JSON Validator?
The JSON Validator checks whether text is valid JSON according to RFC 8259. For invalid input it shows the line and column of the first error, the reason in plain words and the offending source line with a caret. For valid input it summarises the structure and warns about duplicate keys.
How to use JSON Validator
- Paste the JSON into the input box.
- Click Validate (results also update as you type).
- If there is an error, read the line/column and the highlighted source line, fix it and validate again.
- For valid JSON, review the summary (root type, number of objects, arrays and values, depth) and any duplicate-key warnings.
Example
{
"a": 1
"b": 2
} Line 3, column 3 – Expected "," or "}" after the property value
The source line is shown below the message with a caret under the "b".
When to use JSON Validator
Use it before committing a config file, when an API rejects your payload, or when JSON.parse only says "Unexpected token". It checks syntax only; to check that the data has the right fields and types, use the JSON Schema Validator. JSON5/JSONC files will be reported as invalid.
How JSON Validator works
A strict recursive-descent parser reads the text character by character and tracks the current position. It rejects everything the JSON grammar forbids – single quotes, comments, trailing commas, leading zeros, NaN, unescaped control characters, content after the root value – and reports the position where the problem was detected. When parsing succeeds it walks the tree to count objects, arrays and scalar values and to measure nesting depth. Keys that occur twice in the same object are reported with their position, because most parsers silently keep only the last value.
Common Use Cases
- Finding why an API returns 400 Bad Request for a JSON body
- Checking hand-edited package.json or tsconfig-style files (without comments)
- Detecting duplicate keys that would silently overwrite values
- Teaching the exact JSON grammar rules
Security Note
Everything runs locally in your browser; the code you paste is not uploaded.
FAQs
Are comments allowed?
No. JSON has no comment syntax; // and /* */ are reported as errors.
Why is a duplicate key only a warning?
The RFC says names SHOULD be unique but does not make duplicates invalid. Most parsers keep the last value, which often hides bugs.
Does it validate against a schema?
No, it checks syntax only. Use the JSON Schema Validator for structural rules.
Is the column counted in characters or bytes?
In characters (UTF-16 code units), starting at 1.