How to Validate JSON Online
Paste the document and read the parse status before changing it. Turn off common-issue repair when checking whether the original input is strict JSON. A successful syntax check means the document parses, not that its values satisfy your application.
JSON Syntax Rules and Common Errors
JSON requires double-quoted keys and strings, commas between members, and lowercase true, false and null. Trailing commas and comments are not part of strict JSON. Start with the first reported error because later errors can be consequences of it.
JSON Checker vs JSON Schema Validator
A JSON checker checks grammar. JSON Schema can require fields, constrain types and validate ranges. For example, {"age":"30"} is valid JSON but fails a schema that requires age to be an integer.
How to Read JSON Error Messages
Read the line, column or position reported by the parser and inspect the character immediately before it too. An unexpected token can come from a missing comma or quote earlier in the document. Error wording varies between browser engines.
Valid and Invalid JSON Examples
The object {"ready":true} is valid. The forms {ready:true} and {"ready":true,} are invalid strict JSON. An empty input is not a JSON value, while null, an empty array and an empty object are valid values.
More examples and technical details
The JSON Syntax Rules
JSON has a famously small grammar. The entire specification fits on a single page, and the whole language is six value types plus a handful of punctuation rules. That smallness is the point: it makes JSON trivial to parse in any language, and it means a validator can tell you with certainty whether a document is well formed. Here is the complete rule set that a strict parser enforces.
| Rule | Correct form | Why |
|---|---|---|
| Strings use double quotes | "ready" | Single quotes are a JavaScript convention, not a JSON one. Only the double quote character delimits a JSON string. |
| Keys are quoted strings | "count": 3 | Every object key must be a double-quoted string, even a simple identifier with no spaces or punctuation. |
| No trailing commas | [1, 2, 3] | A comma is a separator, never a terminator. A comma before a closing bracket or brace is a syntax error. |
| No comments | none permitted | Neither line comments nor block comments exist in JSON. Put explanatory text in a real key if you need it. |
| Numbers follow a strict grammar | -12.5, 3e8 | An optional minus, digits, an optional fraction, an optional exponent. No leading plus, no leading zeros, no hex. |
| Only three literals | true, false, null | All lowercase. There is no undefined, no NaN, and no Infinity in JSON. |
| Control characters must be escaped | \n, \t, \u001f | Any character below U+0020 inside a string must be written as an escape sequence. |
| One value at the top level | { ... } or [ ... ] | A document holds exactly one value. Anything after it, including a second object, is trailing content. |
Common JSON Errors and How to Fix Them
Nearly every invalid document fails for one of a dozen reasons, and most of them come from writing JSON as if it were JavaScript. The table below covers what actually appears in bug reports, with the fix for each.
| Error | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1, "b": 2,} | Delete the comma before the closing brace or bracket. |
| Single quotes | {'name': 'Ada'} | Replace every single quote with a double quote, on keys and values alike. |
| Unquoted key | {name: "Ada"} | Wrap the key in double quotes to give {"name": "Ada"}. |
| Missing comma between items | {"a": 1 "b": 2} | Insert a comma between the two pairs. The same applies between array elements. |
| Comment present | {"a": 1} // note | Remove the comment, or move the note into a real string field. |
| NaN or Infinity | {"ratio": NaN} | Use null for a missing number, or send the value as a string and interpret it in code. |
| Unescaped double quote in a string | {"q": "she said "no""} | Escape the inner quotes as \" so the string does not terminate early. |
| Literal newline in a string | {"note": "line one↵line two"} | Replace the real line break with the two-character escape \n. |
| Leading zero in a number | {"code": 007} | Write 7, or keep the padding by quoting it as the string "007". |
| Trailing content after the value | {"a": 1}{"b": 2} | Split into two documents, or wrap both objects in a single enclosing array. |
| Wrong case on a literal | {"ok": True} | JSON literals are lowercase: true, false, null. |
| Unclosed bracket | {"list": [1, 2} | Close the array before closing the object. Reformatting makes the mismatch obvious. |
Trailing commas
This is the single most frequent JSON error, because JavaScript, Python, and most modern languages permit trailing commas in their own literals and developers carry the habit across.
{
"host": "db.internal",
"port": 5432,
}{
"host": "db.internal",
"port": 5432
}Quotes inside strings
An unescaped double quote terminates the string early, and everything after it is parsed as structure. The reported error is usually nonsensical because the parser has lost its place several tokens earlier.
{"quote": "he replied "later" and hung up"}{"quote": "he replied \"later\" and hung up"}Numbers that are not JSON numbers
Zip codes, phone numbers, product codes, and country dialling prefixes all break the number grammar because they carry meaningful leading zeros or a plus sign. They are identifiers, not quantities, so quote them.
{"zip": 02134, "dial": +44, "hex": 0xFF}{"zip": "02134", "dial": "+44", "hex": 255}JSON vs JSONC vs JSON5
A large share of validation failures are not really mistakes. They are valid documents in a JSON-like dialect being fed to a strict JSON parser. Knowing which dialect you are holding saves a lot of confusion.
JSONC is JSON with comments. It is what Visual Studio Code uses for settings.json and what TypeScript accepts in tsconfig.json. It permits both // line and /* block */ comments, and most implementations also tolerate trailing commas. Nothing else changes.
{
// strictness settings
"strict": true,
"target": "ES2022",
}JSON5 goes considerably further. It allows unquoted object keys, single-quoted strings, trailing commas, comments, multi-line strings, hexadecimal numbers, leading and trailing decimal points, and the literals Infinity and NaN. It is a much more comfortable format to write by hand and a much less portable one to exchange.
{
name: 'sensor-array', // unquoted key, single quotes
threshold: +0.5,
mask: 0xFF,
limit: Infinity,
}Neither dialect is valid strict JSON, which is exactly why a validator rejects both. That is the correct behaviour rather than a limitation: if you send a commented config to an API, or store JSON5 in a database column that a standard parser will read, it will fail there instead, somewhere less convenient. Strip comments and trailing commas before the data leaves your editor, and keep the relaxed dialects for files that only your own tooling reads.
Once the syntax is clean, the JSON Schema Validator checks the structure and types, and the JSON Formatter makes the result readable. Browse the full collection of free JSON tools to find the right one for the job.
Standards and references
Frequently asked questions
How do I check whether JSON is valid?
Paste it into the validator and disable optional repair to check the original syntax. Read the status and error location.
What errors does a JSON validator detect?
It detects malformed strings, invalid tokens, missing separators and unbalanced structures. It does not know your business rules.
What is the difference between JSON validation and JSON Schema validation?
Syntax validation checks JSON grammar; schema validation checks properties, types and other declared constraints.
Can this tool repair trailing commas or comments?
Optional repair can handle some common comments and trailing commas. Disable it for a strict check, and review any repaired result.
Is my JSON kept private?
No. Input is processed in this browser tab and is not uploaded by the tool. Copy and download are actions you control; ordinary page analytics do not receive tool input.