JSON validator

Check JSON and see every problem with its exact line and column: trailing commas, single quotes, comments, leading zeros, duplicate keys, big numbers.

loading JSON validator
About this tool

What is a JSON validator?

JSON is the format almost every API, config file and log pipeline speaks, and it is strict. A single trailing comma, a single-quoted string or a comment makes JSON.parse throw, and the error you get back is often just "Unexpected token } in JSON at position 31". That tells you something is wrong, but not where to look, and it stops at the first problem even when the document has five.

This validator checks your text against the JSON grammar of RFC 8259 and lists every problem at once, each with an exact line and column and a plain-language message. Click a problem and the editor selects that line. The footer tells you "JSON valid" or counts the errors and warnings, and when the text is valid you get a short summary: an object with N keys, and how deep it nests.

Two kinds of findings exist. Errors mean the text is not JSON. Warnings mean it is valid JSON that may still bite you later: a duplicate key (most parsers keep the last one and silently drop the others) and an integer above 2^53−1, which JavaScript cannot represent exactly.

Everything runs in your browser. Nothing is uploaded, so it is fine for configs and payloads you would rather not paste into a random website. It checks syntax only. It does not know whether a field should be a string or a number; for that use the JSON Schema validator.

How to validate JSON

  1. Paste your JSON into the editor on the left, or open a file. The page starts with a sample full of mistakes so you can see how the messages look.
  2. Read the Problems panel on the right. Every issue is listed with its line and column.
  3. Click a problem to jump to that spot in the editor and fix it by hand.
  4. If there are many small mistakes, press "Fix automatically". The tool shows every line it would remove or add before you accept anything.
  5. Press "Use the fixed text" to replace the editor content, or copy the result. When the footer says "JSON valid", continue in the JSON formatter and tree view.

Examples

Trailing comma

{"a":1,}

The tool reports "Extra comma before }" at line 1, column 7. This is the most common mistake in hand-edited JSON, and also the most common one JavaScript object literals allow, which is why people forget it.

Single quotes and comments

{'a': 1}   -> single quotes are not allowed
// note    -> comments are not allowed

JSON has no comments and only double quotes. Config formats such as JSONC or JSON5 allow both, but a JSON parser will not. Remove the comment or switch quotes.

Numbers JSON does not accept

{"n": 007, "m": +1, "p": .5, "q": 5., "h": 0xFF}

Leading zeros, a plus sign, a bare decimal point and hexadecimal are all rejected. Write 7, 1, 0.5, 5.0 and 255. NaN and Infinity are also rejected, and so are True, None and undefined, which come from Python and JavaScript.

A warning, not an error

{"id": 12345678901234567890}

This is valid, but JavaScript reads it as 12345678901234567000. If the value is an identifier, send it as a string instead.

Common errors

What you wroteWhat is wrong
{"a":1,}Trailing comma before the closing brace
{"a":1 "b":2}Missing comma between members
{a: 1}Key without quotes
{"a" 1}Missing colon
"line1<newline>line2"Raw line break inside a string
"C:\data"Invalid escape; write \\
  • Two documents pasted together. {"a":1}{"b":2} is reported as "text after the value". JSON allows exactly one top-level value.
  • A BOM at the start. Some editors prepend an invisible byte order mark. The validator flags it, because many parsers refuse it.
  • Unclosed brackets. Usually a paste that was cut off. The message names what was left open.

Frequently asked questions

Does it agree with JSON.parse and Python?

Yes. The verdict was compared with JSON.parse and python -m json.tool on 130 hand-written cases and on 4,000 mutated documents. The one deliberate difference is NaN and Infinity: Python accepts them, but RFC 8259 and JSON.parse do not, and this tool rejects them.

Is my data sent anywhere?

No. Validation and the automatic fix run locally in the page.

Can it validate JSON Lines?

No. Several values one after another are reported as "text after the value". Validate each line on its own. It also does not read JSON5 or JSONC.

What does "Fix automatically" do?

It uses the jsonrepair library to guess the intended document, for example removing a trailing comma or quoting a key. It shows a line-by-line diff first. If the text is too broken, it says so rather than guessing. Review the diff, since a repair is still a guess.

Can I validate and format at the same time?

Yes, in two steps: fix the problems here until the footer says "JSON valid", then open the JSON formatter with the same text to pretty-print, sort keys or minify it.

Does it check the structure?

No, only syntax. Use the JSON Schema validator for required fields and types, and JSON diff to compare two versions. To go the other way, see the YAML validator.

Report a problem