JSON Validator

Paste JSON to check whether it is valid. When it isn't, the JSON validator points to the exact line and column and explains the fix in plain English.

Updated
Runs in your browser. Your data is not uploaded. Checks syntax only (RFC 8259). JSON Schema validation is not supported yet.
Checks as you type.

How to use the JSON Validator

  1. Paste JSON into the input box, or upload a .json file up to 5 MB.
  2. The check runs as you type. Press Validate to run it again at any time.
  3. Read the result: a success message with stats, or the error with its line, column, and a suggested fix. Press Format this JSON to open valid input in the formatter.

How it works

The validator uses a strict parser that follows RFC 8259, the JSON standard. It stops at the first error and reports where it is. These common mistakes get a plain-language explanation:

  • Trailing comma before } or ]
  • Single quotes instead of double quotes
  • Keys without quotes
  • Comments (// or /* */)
  • NaN, Infinity, or undefined as values
  • Unescaped control characters, such as a raw tab or line break inside a string
  • Missing comma between values
  • Unclosed bracket or brace

For valid JSON, the stats show the root type, the number of keys and values, the maximum nesting depth, and the size.

Examples

  • {"a": 1,} is invalid: there is a trailing comma before }. Fix: remove the last comma.
  • {'a': 1} is invalid: JSON strings and keys need double quotes.
  • {"a": [1, 2, {"b": null}]} is valid: the root is an object, and the maximum depth is 3.

Common JSON errors and how to fix them

ErrorInvalidValid
Trailing comma{"a": 1,}{"a": 1}
Single quotes{'a': 1}{"a": 1}
Unquoted key{a: 1}{"a": 1}
Comment{"a": 1 // note}{"a": 1}
NaN or undefined{"a": NaN}{"a": null}
Missing comma{"a": 1 "b": 2}{"a": 1, "b": 2}

Most of these come from copying a JavaScript object or a config file written in JSON5. Real JSON is stricter than JavaScript.

Limitations

  • Input is limited to 5 MB.
  • Only the first syntax error is reported. Fix it and the next one, if any, will show.
  • Duplicate keys are allowed by the standard, so they give a warning rather than an error.
  • JSON Schema validation is not supported yet. The tool checks syntax only.

Frequently asked questions

What makes JSON invalid?

The most common causes are trailing commas, single quotes, unquoted keys, and comments. JSON allows none of these.

Can JSON contain comments?

No. The JSON standard has no comment syntax. Formats such as JSON5 and JSONC allow comments, but standard parsers reject them.

Does this validate against a JSON Schema?

Not yet. It checks syntax only.

Is my data private?

Yes. Validation runs in your browser, and nothing is uploaded.

Often used together with the JSON Validator.