Developer Tools
JSON Validator & Fixer
Check whether your JSON is valid, find exactly where it breaks, and repair the most common mistakes automatically, including trailing commas, single quotes, unquoted keys and comments.
Validate JSON
Paste your JSON and press Validate. If it is invalid, press Try to Fix to repair common problems, then review the result.
How to Validate JSON
- Paste your JSON into the box and press Validate.
- If the JSON is valid, you will see a green confirmation along with the number of keys, array items and the nesting depth.
- If it is invalid, the validator shows the error message, the line and column, and the surrounding lines with the problem position marked.
- Press Try to Fix to repair common mistakes automatically. The fixed JSON replaces your input and is validated again, with a list of every type of change made.
What Try to Fix Repairs
| Problem | Invalid | Fixed |
|---|---|---|
| Trailing comma | [1, 2, 3,] | [1, 2, 3] |
| Single quotes | {'name': 'Ali'} | {"name": "Ali"} |
| Unquoted keys | {name: "Ali"} | {"name": "Ali"} |
| Comments | {"a": 1 // note} | {"a": 1} |
| Python values | {"ok": True, "x": None} | {"ok": true, "x": null} |
| JavaScript values | {"x": undefined} | {"x": null} |
| Raw line break in a string | a string split over two lines | "line one\nline two" |
The fixer cannot guess missing brackets, missing commas between items or text that is cut off. For those, use the line and column shown by the validator to find and correct the problem by hand.
Common JSON Error Messages Explained
- Unexpected token – a character appeared where it is not allowed, often a single quote, a comment, or a word without quotes.
- Expected property name or '}' – usually a trailing comma at the end of an object, or a key without double quotes.
- Expected ',' or ']' after array element – a comma is missing between two items in a list.
- Unexpected end of JSON input – the JSON is cut off, or a closing
}or]is missing. - Bad control character in string literal – a string contains a real line break or tab. These must be written as
\nand\t. - Unexpected non-whitespace character after JSON – there is extra text after the end, or two JSON objects were pasted one after another.
Why JSON Is So Strict
JSON looks like JavaScript, but it is a deliberately simple data format designed so that every programming language can read it in the same way. Features such as comments, single quotes and trailing commas are allowed in JavaScript code but not in JSON. Formats such as JSON5 and JSONC (used in VS Code settings) allow some of these, but most APIs and parsers require strict JSON, which is what this validator checks.
Privacy
Validation and repairs run entirely in your browser. Your JSON is never uploaded, so it is safe to check API keys, tokens and private data.
Frequently Asked Questions
How do I check if my JSON is valid?
Paste it into the validator and press Validate. A green message confirms valid JSON. Otherwise the error, line and column are shown with the problem position highlighted.
Can this tool fix invalid JSON automatically?
Yes. Try to Fix repairs trailing commas, single quotes, unquoted keys, comments, Python values such as True and None, and raw line breaks inside strings. It cannot reconstruct missing brackets or missing data.
Are comments allowed in JSON?
No. Standard JSON does not support comments. Some tools accept JSONC or JSON5, which do, but APIs and most parsers expect strict JSON.
Why are single quotes invalid in JSON?
The JSON specification only allows double quotes around keys and strings. This keeps the format simple and consistent across programming languages.
What does "Unexpected end of JSON input" mean?
The parser reached the end before the JSON was complete. Usually a closing bracket or brace is missing, or the data was cut off when copying.
Is my data uploaded?
No. Everything happens locally in your browser.