json:yaml

JSON validator

Paste a document and find out whether it is valid JSON — and if it is not, exactly where the parser gave up and what it expected instead.

JSON
JSON

      
Paste JSON to convert.

Conversion happens in this browser tab. Nothing is uploaded, logged, or stored.

What is being checked

The validator parses your document against the JSON grammar defined in RFC 8259. If it parses, it is valid; if it does not, you get the line, the column, and a plain explanation of what the parser expected instead. There is no "mostly valid" — JSON is a small, strict grammar with no dialects.

The formatted output on the right is your confirmation. If output appears, the document parsed. If the status bar is red, it did not, and the position given is the first place the parser could not continue — which is usually just after the real mistake, not at it.

What each error actually means

MessageCauseFix
Unexpected token }A comma before the closing braceRemove the trailing comma
Unexpected token ]A comma before the closing bracketRemove the trailing comma
Unexpected end of JSON inputA brace, bracket, or quote never closedFormat the document and look at the indentation
Unexpected token 'Single-quoted stringJSON only allows double quotes
Expected property nameAn unquoted keyQuote every key
Unexpected token /A // or /* */ commentJSON has no comments — remove them or switch to JSONC/YAML
Unexpected non-whitespace character after JSONTwo documents concatenatedWrap them in an array, or treat the file as JSON Lines
Bad escaped characterA lone backslash in a stringEscape it as \\

The rules in full

  • Strings use double quotes only. Never single quotes, never backticks.
  • Every object key is a quoted string, including keys that look like identifiers.
  • No trailing comma after the last element of an object or array.
  • No comments of any kind.
  • Numbers cannot have leading zeros, a leading +, or a trailing decimal point. NaN and Infinity are not valid JSON.
  • The literals are true, false and null, lowercase. True and None are Python, not JSON.
  • Control characters inside strings must be escaped.
  • The document must be a single value. Two objects side by side is not JSON.

Once a document parses, the formatter will lay it out readably and the minifier will strip it back down. For the same checks on YAML, use the YAML validator.

Valid syntax is not the same as correct data. If you need to check that a document has the right fields with the right types, that is JSON Schema — a separate layer on top of syntax validation.

Validating in a pipeline

# fail the build on any malformed JSON in the repo
find . -name '*.json' -not -path './node_modules/*' \
  -exec sh -c 'jq empty "$1" || exit 255' _ {} \;

# Python, no dependencies
python -m json.tool config.json > /dev/null

Both exit non-zero on failure, so either works as a pre-commit hook or a CI step.

Your broken file stays yours

Validators get the rawest input of any tool on this site. When something has already failed, people paste the actual payload — the webhook body, the API response, the log line — complete with tokens, email addresses, and customer records, because they are debugging and not thinking about tidying it first.

That is exactly the case worth designing for. Validation runs in your browser using its own JSON parser. Nothing is transmitted, nothing is stored, and reloading the page discards it.

Questions people ask

What does 'Unexpected end of JSON input' mean?
A brace, bracket, or quote was opened and never closed, so the parser hit the end of the file while still waiting. Format the document and look at where the indentation stops making sense.
Can JSON have comments?
No. The specification has no comment syntax. Some parsers accept them as an extension — often called JSONC — but a standard parser will reject the file. Use YAML if you need comments.
Are trailing commas allowed?
No. A comma after the last element of an object or array is invalid JSON, even though JavaScript itself allows it. This is the single most common cause of a JSON parse error.
Does this check my data against a schema?
No, this checks syntax only. Verifying that a document has the right fields with the right types is JSON Schema validation, which is a separate layer.
Are single quotes valid in JSON?
No. JSON strings must use double quotes. Single quotes are a Python and JavaScript habit that does not carry over.
Is my document sent to a server?
No. Validation runs in your browser using the native JSON parser.