JSON Validator
Check syntax and get the parser’s exact error and position.
JSON Raw Input
Reading a JSON syntax error
When parsing fails, the message names both what went wrong and where. Unexpected token } in JSON at position 47 means the parser reached a closing brace while it still expected a value or another key — most often a trailing comma after the final entry, which JavaScript object literals allow and JSON does not.
The position is a character offset from the start of the document, not a line number. In a minified payload that is the fastest way to find the fault; in a formatted one, count forward or paste the text into an editor that shows offsets. Note that the reported position is where the parser gave up, which can be slightly after the actual mistake.
The three faults that account for most failures are all borrowed habits from JavaScript: trailing commas, single quotes instead of double, and unquoted keys. JSON allows none of them. Comments are the fourth — legal in JSONC and JSON5, rejected here.
Frequently asked questions
What makes JSON invalid?
Most often a trailing comma after the last element, single quotes instead of double quotes, unquoted keys, or comments. All four are valid JavaScript and none is valid JSON.
What does “Unexpected token” actually mean?
The parser found a character it could not use at that point in the grammar. The named token is what it found; the position is how far it read before giving up — usually just past the real mistake.
Is the position a line number?
No, it is a character offset from the start of the document. Paste the text into an editor that reports offsets, or format it first, to locate the line.
Does valid JSON mean my data is correct?
Only that the syntax parses. It says nothing about whether required fields are present or values have sensible types — that is schema validation, which is a separate step using something like JSON Schema.
Are comments allowed in JSON?
No. The specification has no comment syntax. JSONC and JSON5 add them, but they need a parser that supports those dialects.