JSON Validator checks whether your JSON is valid and, if not, points to the exact line and column of the first error and moves the cursor there. It tells you what valid JSON contains, such as an object with 12 keys or an array of 50 items. If the JSON is almost right, Repair fixes common mistakes in one click. Your data stays in your browser.
How to validate JSON
- Paste your JSON, or click Open file to load a .json file. A file is checked as soon as it opens.
- Click Validate.
- Valid: you see what the JSON contains and a formatted copy.
- Invalid: the error message gives the line and column, and the cursor jumps to that spot. Fix it and validate again.
- Many errors at once? Click Repair to fix trailing commas, comments, single quotes and unquoted keys together.
Common JSON errors and fixes
| Error | Example | Fix |
|---|---|---|
| Trailing comma | {"a": 1,} |
Remove the last comma |
| Missing comma | {"a": 1 "b": 2} |
Add a comma between items |
| Single quotes | {'a': 'x'} |
Use double quotes |
| Unquoted key | {a: 1} |
Put the key in double quotes |
| Comment | {"a": 1 // note} |
Remove the comment |
| Python values | {"ok": True} |
Use true, false, null |
| Special numbers | {"x": NaN} |
Use null or a number |
| Unescaped quote in a string | "say "hi"" |
Write \"hi\" |
Repair handles most of these. An unescaped quote inside a string usually needs fixing by hand, since only you know where the string should end.
Where invalid JSON comes from
- Hand-edited config files, where a trailing comma or a comment slips in.
- JavaScript objects copied from code, with single quotes and bare keys.
- Python output pasted from
print(), with True, False and None. - Truncated responses from a log or a terminal, cut off mid-object.
- Template output where a variable was empty and left
"a": ,behind.
Validate before you send
APIs, deployment pipelines and app configs refuse invalid JSON, often with an unclear message far from the cause. Validating first saves a round trip: you see the exact position, fix it here and send JSON you know is well-formed. To compare a working and a broken version line by line, paste both into the Diff Checker.
Also in this tool
The same page formats JSON with 2 or 4 spaces or tabs, minifies it, sorts keys and shows a collapsible tree. See JSON Formatter for all features, or JSON Minifier to make it as small as possible.