JSON validator
Paste JSON to check that it's valid. If it isn't, you get the exact line and column, the line highlighted, the reason in plain English, and a button that repairs the usual mistakes.
- 100% free
- Runs in your browser
- No uploads
The result appears here: whether the JSON is valid, and if not, where and why.
- Runs on your deviceEvery tool works directly in your browser. No files are uploaded.
- Your privacy mattersYour files never leave your device, so there's nothing for us to store.
- No limitsUse any tool as much as you need. No daily caps, no waiting.
- Completely freeNo signup and no trial to cancel. Ads keep the tools free.
How to validate JSON
- Paste or drop your JSON. Paste into the box or drop a .json file on it. Files up to 50 MB are fine.
- Read the result. Valid JSON shows a green confirmation with the number of values and how deeply they're nested. Invalid JSON shows the line and column, the reason and the line itself with a caret under the problem.
- Jump to the mistake. Go to the error puts the cursor on the exact character in your text, and that line is highlighted.
- Fix it by hand or press Try to fix. The repair lists every kind of change with line numbers and shows the result before you use it.
Common JSON errors and how to fix them
These nine mistakes cause almost every invalid JSON file. The validator names each one when it finds it.
| Error | Invalid | Valid | Fix |
|---|---|---|---|
| Trailing comma | {"a": 1, "b": 2,} | {"a": 1, "b": 2} | Remove the comma before } or ]. |
| Single quotes | {'a': 'x'} | {"a": "x"} | Strings and keys need double quotes. |
| Unquoted key | {name: 1} | {"name": 1} | Wrap every key in double quotes. |
| Comment | {"a": 1 // note} | {"a": 1} | Delete comments; JSON has none. |
| Curly quotes | {“a”: “x”} | {"a": "x"} | Word processors and chat apps swap " for “ ”. |
| Python values | {"ok": True, "v": None} | {"ok": true, "v": null} | Use lower-case true, false and null. |
| NaN or Infinity | {"ratio": NaN} | {"ratio": null} | Use null or a real number. |
| Leading zero | {"zip": 02134} | {"zip": "02134"} | Quote codes that must keep their zeros. |
| Missing comma | {"a": 1 "b": 2} | {"a": 1, "b": 2} | Separate items with commas. |
Example: JSON copied from a chat assistant
AI assistants often write JavaScript object syntax and call it JSON. This reply has six problems: a comment, single quotes, an unquoted key, a trailing comma, Python's True and curly quotes.
{
// Settings an assistant suggested
'name': 'Ada Lovelace',
born: 1815,
"languages": ["English", "French",],
"active": True,
"notes": “Analytical Engine”,
}The validator stops at line 2, column 3 ("JSON doesn't allow comments"). Try to fix removes the comment and the two trailing commas, changes the quotes, quotes born and lower-cases true, then checks the result again.
What the validator checks
It follows the JSON standard (RFC 8259) exactly, with its own parser rather than the browser's, so you get the same line and column in every browser. Safari's built-in JSON errors, for example, don't give a position at all.
- Strings: double quotes only, no raw line breaks or tabs, and only valid escapes like \n, \" and \u00e9.
- Numbers: no leading zeros, no leading + or bare decimal point, no hex. Big numbers are accepted with all their digits.
- Structure: brackets that match, commas between items but not after the last one, a colon after every key.
- Only one top-level value. Two objects one after the other are invalid unless they're wrapped in an array.
- Duplicate keys are valid but flagged, since
{"id": 1, "id": 2}silently becomes{"id": 2}in most programs.
Files with comments such as tsconfig.json or VS Code settings use a looser format called JSONC. They will show as invalid here, which is correct for standard JSON.
Frequently asked questions
What makes JSON invalid?
JSON is stricter than JavaScript. Every property name and string needs double quotes, there can't be a comma after the last item, comments aren't allowed, and only true, false and null are valid words. NaN, Infinity, undefined and numbers with leading zeros like 007 are also invalid. One wrong character anywhere makes the whole document invalid.
Why does the error point to a line after the real mistake?
The validator reports the first place where the text stops making sense, which can be after the actual slip. A missing comma at the end of line 4 is only noticed when the next property starts on line 5. A string that is never closed is reported where it starts. Look at the highlighted line and the one above it.
Is it safe to paste API keys or customer data?
Yes. Validation runs in your browser in a background worker and nothing is uploaded or saved. You can check this by opening your browser's network panel while you validate: no request is made.
What does Try to fix change?
Only the mistakes it recognises: comments, trailing and missing commas, single or curly quotes, unquoted keys, Python's True, False and None, NaN and Infinity, JavaScript-style numbers, code fences and chat text around the JSON, unescaped line breaks in strings and brackets missing at the end. It lists each kind of change with its line numbers, and you choose whether to use the result.
Why does valid JSON still fail in my program?
Valid JSON can still be the wrong shape for your code: a field may be missing, a number may arrive as a string, or a list may be empty. The validator also warns about duplicate keys, which are allowed but usually mean data is lost, because most parsers keep only the last value.