To validate JSON, paste it into the box: valid JSON is formatted straight away, and invalid JSON shows the error with its line and column. Valid JSON uses double quotes for every key and string, has no trailing commas or comments, and its only values are strings, numbers, true, false, null, objects and arrays.
JSON rules in one table
| Rule | Valid | Invalid |
|---|---|---|
| Keys in double quotes | {"name": "Ana"} | {name: "Ana"} |
| Strings in double quotes | "hello" | 'hello' |
| No trailing comma | [1, 2, 3] | [1, 2, 3,] |
| No comments | {"a": 1} | {"a": 1 // one} |
| Lower-case literals | true, false, null | True, NULL, undefined |
| Plain numbers | 0.5, 10, -3e2 | .5, 010, NaN |
How to fix an “Unexpected token” error
- Go to the line and column the tool shows. The pointer marks where the parser gave up.
- Look just before that point too. A missing comma on the line above often shows up as an error at the start of the next line.
- Check for a trailing comma before a closing
}or]. - Replace single quotes and curly “smart” quotes copied from a document with straight double quotes.
- If the text starts with
<, it's HTML, not JSON: the server probably returned an error page.
Where you'll meet JSON
API responses, app config files, package.json, WordPress and Shopify exports, webhooks from tools like n8n, and the structured data that helps Google understand your pages. That last one is JSON-LD, and you can build it without writing any JSON by hand using the Schema Markup Generator.