JSON validator that shows exactly where it breaks
Paste JSON and see exactly where it breaks, with a plain explanation.
Your JSON is checked on this device and is never uploaded. How your data stays local.
Problems
JSON Mill's validator checks JSON against the JSON standard (RFC 8259) as you type and points to the exact line and column where it stops being valid, with a message in plain English such as Trailing comma before "}" or Strings must use double quotes.
It also warns about valid but risky JSON, such as an object that repeats a key, which makes it a JSON linter too. It runs in your browser, so nothing is uploaded.
How to validate JSON
- Paste or open your JSON. Paste it into the source panel or drop a file on the workspace. Checking starts as soon as you stop typing.
-
Read the result. The status line says Valid JSON with the size and number of values, or Not valid JSON. When there is an error, the result panel shows
Line 5, column 22:and the message. - Jump to the problem. Press Go to to put the cursor on the error in the editor. The error is also marked in the editor's gutter and listed under Problems with any warnings.
- Fix it, or let JSON Mill try. Correct the text and the check runs again. For common mistakes such as trailing commas, comments or single quotes, press Repair to see a suggested fix before applying it.
Example: a duplicate key and a missing comma
A product record that repeats the price key and is missing a comma between two tags.
{
"name": "Trail Lantern",
"price": 34.5,
"price": 36.0,
"tags": ["camping" "lighting"],
"in_stock": true
}
Line 4, column 3: Duplicate key "price"; both entries are kept
Line 5, column 22: Expected "," or "]"
The missing comma is the error that makes the JSON invalid, so JSON Mill reports where it expected a comma or a closing bracket. The repeated price key is valid JSON but a warning: most parsers keep only the last value, so 34.5 would be silently lost.
Messages you might see
| Message | What it means |
|---|---|
Trailing comma before "}" |
A comma after the last item of an object or array. JSON does not allow it, though JavaScript does. |
Strings must use double quotes |
A string in single quotes, such as 'name'. |
Comments are not allowed in JSON |
A // or /* */ comment. JSON has no comments; JSON5 and JSONC do. |
Expected "," or "]" |
Two values without a comma between them, often a missing comma at the end of a line. |
Expected a property name in double quotes |
An unquoted key, such as {name: 1}, or a stray character where a key should be. |
Unexpected word; strings and keys need double quotes |
An unquoted word where a value should be, such as True or None from Python. |
Unexpected content after the JSON value (is this JSON Lines?) |
More than one JSON value in the text. If each line is a record, it is JSON Lines, and JSON Mill checks it line by line instead. |
Unexpected end of input |
The text stops before every bracket is closed, often a truncated file or a copy that missed the end. |
Options
| Option | What it does |
|---|---|
| Problems | Lists the error and every warning with its line and column. Click one to jump to it. |
| Repair | Appears when the JSON is invalid. Suggests fixes for common mistakes and lists every change before you apply it. |
Limits
- For a JSON document, checking stops at the first syntax error, because everything after it can no longer be read reliably. Fix it and the next error, if any, appears. Warnings found before the error are listed too.
- JSON Lines files are different: each line is checked on its own, so every bad line is reported with its line number.
- The validator checks syntax, not structure. It does not validate against a JSON Schema.
Questions
- How do I find where my JSON is invalid?
- Paste it on this page. JSON Mill shows the line and column of the first syntax error with a plain explanation, and Go to puts the cursor right on it. The problem is also marked in the editor gutter.
- Does it show every error at once?
- For JSON Lines, yes: every invalid line is listed. For a single JSON document, JSON Mill reports the first syntax error, because after a syntax error the rest of the text cannot be read reliably. Fix it and the check runs again, or press Repair to fix common mistakes in one go.
- Why does my JSON work in JavaScript but fail here?
- JavaScript object literals allow things JSON does not: trailing commas, single quotes, unquoted keys, comments and values such as
undefinedorNaN. JSON Mill checks against the JSON standard, which is whatJSON.parseand other languages' parsers expect. - Can it check JSON against a schema?
- No. The validator checks that the text is valid JSON. Checking that the data has the fields and types a JSON Schema requires is not supported.
Related tools
Last updated