JSON Validator
Validate JSON syntax and get a structural summary — keys, depth, size.
What Is a JSON Validator?
A JSON validator parses your JSON and tells you whether it is syntactically valid according to the RFC 8259 specification. If there is an error, you get the exact line and column number so you can fix it fast. If the JSON is valid, you get a structural summary — root type, total keys, array items, nesting depth, and file size.
How to Validate JSON
- Paste your JSON into the Input pane, or click Upload to load a
.jsonfile. - Optionally paste a public JSON URL into the Fetch from URL bar to load a remote endpoint directly.
- Click Validate — the result appears instantly in the Output pane.
- Enable Live mode to auto-validate as you type (300 ms debounce) — no button click needed.
- A ✓ Valid JSON badge means your JSON is syntactically correct.
- A ✕ Invalid JSON badge shows the error message with line and column number.
- Use JSONC mode to validate JSON that contains
//or/* */comments (common in config files). - Use Repair to auto-strip trailing commas and the UTF-8 BOM before validating.
- Click Explain with AI to get a plain-English description of what your JSON data represents.
What the Validation Summary Shows
When your JSON is valid, the output pane shows a summary comment alongside the pretty-printed JSON so you can copy or download both together:
- Root type — whether the JSON root is an
object,array,string,number,boolean, ornull. - Keys — total count of all object keys across every nesting level.
- Depth — deepest level of nesting in the structure (a flat object is depth 1).
- Size — byte size of the raw input string.
Proper JSON Format Rules
JSON is defined by a strict grammar. The most common mistakes come from confusing JSON with JavaScript object literals, which are more permissive. Key rules:
- Double-quoted strings only — all string values and all object keys must use double quotes (
"). Single quotes are not valid. - No trailing commas —
{ "a": 1, }and[1, 2, ]are both invalid. The last item must not have a following comma. - No comments — standard JSON has no comment syntax. Use JSONC mode to strip
//and/* */comments before validating. - Keys must be strings —
{ name: "Alice" }is JavaScript syntax, not JSON. Keys must be double-quoted:{ "name": "Alice" }. - No
undefined,NaN, orInfinity— JSON only allowstrue,false,null, numbers, strings, arrays, and objects. - Numbers have no leading zeros —
07is not a valid JSON number (7is). - Strings must escape control characters — literal newlines inside string values are not valid; use
\ninstead. - Unicode escape sequences must be 4 hex digits —
\uXXXXonly. Incomplete sequences cause parse errors. - Root value can be any JSON type — the root does not have to be an object.
"hello",42, and[1, 2, 3]are all valid JSON documents.
Common JSON Validation Errors — and How to Fix Them
- Unexpected token ',' — trailing comma in an object or array. Enable Repair to remove it automatically, or delete the comma before the closing
}or]. - Unexpected token "'" (single quote) — replace all single quotes with double quotes for both keys and string values.
- Unexpected token (identifier) — an unquoted key such as
name: "Alice". Wrap the key in double quotes. - SyntaxError: Unexpected end of JSON input — a missing closing brace (
}) or bracket (]). Check that every opening bracket has a matching close. - Unexpected token '/' — a comment (
// ...or/* ... */) in the JSON. Enable JSONC mode to strip comments before parsing. - Duplicate keys — technically tolerated by most parsers (the last value wins) but a sign of a bug. Search your JSON for repeated key names at the same level.
JSON Validator vs JSON Formatter
A validator tells you whether your JSON is valid and shows you structural metadata. A formatter (or beautifier) re-indents valid JSON to make it human-readable. This tool does both: it validates your JSON and outputs a pretty-printed copy so you can copy or download it immediately. For full formatting options (indent size, sort keys, null removal) use the JSON Formatter.
Related Tools
- JSON Formatter — pretty-print valid JSON with full indent and sort options
- JSON Minifier — compress JSON for production
- JSON Viewer — explore JSON as an interactive collapsible tree
Is My JSON Sent to a Server?
No. All validation runs entirely in your browser using the native JSON.parse() function. Your data never leaves your machine. The AI Explain feature sends only the text you choose to explain — it does not run automatically.