How to validate JSON
- Paste your JSON into the JSON to check box, or drop a
.jsonfile on it. - Read the result. A green message says Valid JSON and describes the top-level value, such as an object with 12 keys.
- If something is wrong, the message gives the line and column. Go to that spot, fix it and the check runs again by itself.
- Leave Warn about duplicate keys on to catch repeated keys inside one object.
What counts as invalid
JSON is stricter than JavaScript. These are the mistakes people hit most often:
- A trailing comma after the last item:
{"a": 1,}. - Single quotes around strings or keys:
{'a': 1}. - Unquoted keys:
{a: 1}. - Comments and a leading BOM or stray text before the first brace.
- Numbers such as
01,.5or1.and values likeNaN,undefinedorInfinity. - A string with a raw line break inside it. Use
\ninstead.
The error points to the character where the parser first noticed the problem. The real mistake is sometimes just before it, such as a missing comma on the line above.
Validator or formatter?
This page tells you whether the JSON is correct and where it breaks. If you also want it laid out neatly, minified or sorted, use the JSON formatter, which reports the same errors and gives you the cleaned-up text.
Tips
- If your data is YAML, convert it first with YAML to JSON; a parse error there points to the YAML line.
- For a tabular file, CSV to JSON creates valid JSON for you.
- Large inputs are checked in a background thread, so the page keeps responding.
Privacy
Config files and API payloads often contain keys and personal data. Everything here happens on your device. Nothing is uploaded, stored or logged.