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.

JSON Input
Waiting for input…

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 valuesundefined and NaN are JavaScript values, not valid JSON. Use null for 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 comments and 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.

Frequently asked questions

Validation checks whether the JSON is syntactically correct according to the RFC 8259 standard and tells you exactly where the error is if not. Formatting reformats valid JSON with indentation for readability. You must have valid JSON before you can format it. This tool validates and shows structural stats; the JSON Formatter tool validates and then reformats.

No. This tool checks JSON syntax — whether the text is well-formed JSON. It does not validate JSON against a schema (checking whether the values match expected types or required fields). JSON Schema validation requires a separate schema file and a schema validator library.

Your editor might support JSONC (JSON with Comments) which allows trailing commas and comments. Many editors like VS Code default to JSONC mode for config files. This validator uses strict RFC 8259 JSON, which does not allow comments or trailing commas. Use the JSON Repair tool to strip those before validating.

No. All validation happens in your browser using the native JSON.parse() function. Nothing is sent to MockServer or any other server. Your data stays entirely local.