JSON Validator
Paste JSON and get an instant pass/fail result with exact error location. Also shows structure stats — key count, nesting depth, and size.
What does this JSON validator check?
This tool validates JSON against the RFC 8259 specification — the formal standard that defines valid JSON. It uses your browser's native JSON.parse() which is the same parser used by every JavaScript runtime. If your JSON passes this validator, it will parse correctly in Node.js, browsers, and any standard JSON library.
On success, the tool shows a structural breakdown: total key count, maximum nesting depth, number of arrays and objects, and file size. On failure, it shows the exact error message and pinpoints the line and column of the problem.
Common JSON syntax errors and how to fix them
- Trailing comma —
{"a":1,}— a comma after the last item in an object or array is not allowed in JSON. Remove the trailing comma. - Single-quoted strings —
{'key':'value'}— JSON requires double quotes for all strings. Replace single quotes with double quotes. - Unquoted keys —
{key:"value"}— every object key must be a double-quoted string. JavaScript object literals allow unquoted keys but JSON does not. - Missing comma between items —
{"a":1 "b":2}— comma required between every key-value pair. - Comments —
// comment— JSON does not support comments. Remove them before validating. - Mismatched brackets — opened with
[but closed with}, or vice versa. Count opening and closing brackets carefully. - Undefined or NaN values —
undefinedandNaNare JavaScript values, not valid JSON. Usenullfor missing values and represent NaN as a string or omit the field.
JSON vs JSON5 vs JSONC — which format do you have?
This validator enforces strict RFC 8259 JSON. It will flag trailing commas and comments as errors. If you are working with a configuration file format that allows comments or trailing commas, you may have one of these variants:
- JSONC (JSON with Comments) — used by VS Code's
settings.json,tsconfig.json, and many editor config files. Looks like JSON but allows// line commentsand trailing commas. - JSON5 — a superset of JSON that also allows unquoted keys, single-quoted strings, and multi-line strings. Used in some build tools.
To validate or repair JSONC or JSON5, use the JSON Repair tool which strips comments and fixes common issues before parsing.
Understanding the structure stats
When validation passes, the stats grid shows: File size — the byte length of your input; Total keys — the number of object keys across all nested levels; Max depth — how deeply nested the structure is (a flat object has depth 0, one level of nesting is depth 1); Arrays and Objects — how many of each type appear in the whole structure; Lines — the line count of your formatted input.