JSON Schema Validator
Validate JSON data against a JSON Schema definition.
Paste JSON to validate its syntax instantly. Get clear error messages showing the exact line and position of the problem, and catch common issues like trailing commas and single quotes before they break your code. Free, online, and 100% client-side.
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. |
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. |
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
}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"}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}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.
A single misplaced comma can take down a deployment, and default parser errors rarely tell you where the problem is. This free online JSON validator acts as a JSON lint and syntax checker in one: paste any JSON and it is parsed instantly, with failures reported as clear messages that point to the exact line and character position. It catches the classics (trailing commas, single quotes, unquoted keys, comments) that trip up copy-pasted JavaScript object literals and hand-edited config files. When your JSON passes, you also get a beautified version and a tree view for inspection. Everything runs client-side, so validating API responses, environment configs, and data exports never exposes your data to a server.