Paste a payload and find out in one keystroke whether it parses — and if it does not, exactly which line, column and character broke it. This JSON linter turns the parser's message into something you can act on, so you fix the comma instead of hunting for it. Everything runs in your browser.
To validate JSON means one narrow thing: asking whether the text conforms to the grammar in RFC 8259. That grammar is tiny — six value types, strings in double quotes, commas between elements and nothing after the last one. A JSON syntax checker stops at the first character that cannot legally appear where it appears; reach the end without stopping and your JSON is valid.
Two very different questions both get called validation, and only the first is answered here.
| Question | Defined by | Checked here? |
|---|---|---|
| Syntactic validity Is this parseable JSON at all? |
RFC 8259 — the format itself | Yes |
| Schema validity Does it match the shape my application expects? |
A JSON Schema document that you write | No — a separate tool |
So a document can pass here and still be useless to your code: {"age": "forty-two"}
is flawless JSON and completely wrong if your API expects a number. Check syntax first,
shape second — a schema validator has to parse before it can inspect.
Because indenting requires parsing, the JSON formatter validates too: if it refuses to produce output, the input is not valid JSON.
.json file onto the page. Parsing runs locally, so nothing is uploaded.
One error at a time is by design: past an illegal character a parser no longer knows what
you intended. The cursor readout also shows Ln and Col for
steering through a long file.
Almost every JSON error has one root cause: JSON looks like a JavaScript object literal but is far stricter. Engines word the same failure differently, so match the shape of a message, not the letter.
| Parser message | What it really means | How to fix it |
|---|---|---|
Expected double-quoted property name / Unexpected token ']' |
A trailing comma before the closing brace or bracket | Delete the comma after the last element |
Expected property name or '}' |
A single-quoted key, or a key with no quotes at all | Wrap every key in double quotes |
Unexpected token '/' |
A // or /* */ comment in the file |
Strip the comments, or switch the reader to JSONC |
Bad control character in string literal |
A real newline or tab pasted inside a string | Escape it as \n or \t |
Bad escaped character |
A lone backslash — usually a Windows path or a regex | Double it: "C:\\Users" |
Unexpected token 'N' / 'I' / 'u' |
NaN, Infinity or undefined leaked out of the serialiser |
Use null or omit the key |
Unexpected end of JSON input / Unterminated string |
The payload is truncated, or a bracket was never closed | Check the response arrived whole; count brackets |
Unexpected token '<' |
An HTML error page came back instead of JSON. An invisible BOM before the first { fails the same way |
Check the HTTP status; save files as UTF-8 without BOM |
| no error at all | Duplicate keys. Legal, silent, and a real source of bugs | Nothing to fix syntactically — see below |
The most common JSON error by a wide margin, and the nastiest: the offending comma sits on a line you did not touch — you deleted the entry after it.
{
"items": [1, 2, 3,],
"total": 3,
}
{
"items": [1, 2, 3],
"total": 3
}
Note where the parser points: not at the comma but at the } or ]
that followed it. Always look one token left of the reported position.
JSON has exactly one string delimiter, the double quote, and it applies to keys as well as values.
{
name: 'Ada',
'role': "engineer"
}
{
"name": "Ada",
"role": "engineer"
}
Python is the other frequent source: printing a dict gives {'name': 'Ada'}
with single quotes and True, False and None
capitalised — none of it JSON. Use json.dumps(), not print().
There is no comment syntax in the JSON grammar; it was left out so nobody could smuggle parsing directives into a data format.
{
// the port the server listens on
"port": 8080, /* default */
"debug": false
}
{
"_comment": "port the server listens on",
"port": 8080,
"debug": false
}
tsconfig.json and VS Code's settings.json do accept comments —
those are read as JSONC, a superset. Send the same file to an API expecting JSON and it is
rejected.
Two rules govern the inside of a JSON string, and this example breaks both. A backslash
always begins an escape sequence, and only nine are legal:
\" \\ \/ \b \f
\n \r \t and \uXXXX. And every character
below U+0020 — a line break, a spreadsheet tab — must be escaped.
{
"path": "C:\Users\ada\data.json",
"note": "first line
second line"
}
{
"path": "C:\\Users\\ada\\data.json",
"note": "first line\nsecond line"
}
\U is not one of the nine, so the parser stops on the first backslash of the
Windows path. The lesson: never build JSON by concatenating strings — let a real serialiser
do the escaping.
A green pill answers exactly one question. Everything below is well-formed JSON that any validator will pass, and each has cost somebody an afternoon.
JSON.parse silently keeps the last, so {"id": 1, "id": 2} becomes
{"id": 2}. Other implementations keep the first, so two services can disagree
about one file while both call it valid.
JSON.parse('{"id": 9007199254740993}').id
// → 9007199254740992 off by one, silently
Send such identifiers as strings.
null is not the same as a missing key.
{"middleName": null} asserts there is no middle name; {} says
nobody asked. A check like if (!user.middleName) flattens a distinction the
data was careful to make — use "middleName" in user instead.
42, "text",
true and null are each a valid JSON text. A parser that insists
on an object or array is out of date.
null or {}. This tool shows
an Empty state for a blank editor, but an empty API response is a real bug.
None of these is catchable by a syntax checker — the honest limit of what any JSON linter can promise. Past parsing, the rest belongs to your schema, tests and types.
Paste it into a validator and read the verdict. Valid JSON parses cleanly from the first character to the last with nothing left over, and here the status pill says Valid JSON or Invalid JSON as you type. JSON has no warnings, only errors.
The trailing comma — a comma left after the final element of an array or the final pair of an object, usually because someone deleted the last entry by hand. JavaScript and Python accept it, JSON never has. Single quotes are a close second.
No. RFC 8259 defines no syntax for comments, and strict parsers reject both the double-slash and slash-star forms. Files such as tsconfig.json accept them because those tools read JSONC, a superset, not because JSON changed. In plain JSON, move the note into a key such as _comment.
No. A comma goes between two values and never after the last one, so [1, 2, 3,] is invalid, as is an object whose final pair is followed by a comma. JSON5 and JSONC allow them; strict JSON does not, so the same text can pass in your editor and fail in your API.
It can, and most parsers will not complain. RFC 8259 says names within an object should be unique — a recommendation, not a requirement — and JavaScript keeps the last it sees. Because other implementations keep the first, duplicate keys are a portability bug no validator will flag.
No. It checks syntax only: whether the text is well-formed JSON a parser can read. Confirming that a document carries the right keys, types and value ranges is JSON Schema validation, a separate step needing a schema file.