How to validate JSON
- Paste your JSON into Input. It's checked as you type.
- If it's valid, the status line says Valid JSON and you get a formatted copy.
- If not, the status line gives the line, the column and what’s wrong there, such as “trailing comma before }”. Click Show me to select that spot in your JSON, fix it and the check runs again. Or turn on Fix mistakes to repair common errors automatically.
Valid and invalid JSON
| Invalid | Valid | Rule |
|---|---|---|
{"tags": ["a", "b",]} |
{"tags": ["a", "b"]} |
No trailing commas |
{'id': 7} |
{"id": 7} |
Double quotes only |
{id: 7} |
{"id": 7} |
Keys must be quoted |
{"a": 1 "b": 2} |
{"a": 1, "b": 2} |
Commas between items |
{"n": NaN} |
{"n": null} |
No NaN, Infinity or undefined |
{"zip": 0042} |
{"zip": "0042"} |
No leading zeros on numbers |
Reading the error position
The line and column point to where the parser gave up, which is often just after the real mistake. A missing comma is reported at the start of the next key, because that’s where a comma was expected. A trailing comma is reported at the closing brace or bracket that follows it. If nothing looks wrong at the reported spot, look at the end of the line before it.
Your JSON is checked in your browser, so it’s fine to paste config files or API responses that contain keys or personal data.