JSON's rules are genuinely simple, but they're also strict, which means small habits carried over from JavaScript or other languages can quietly break a payload.
The most common mistakes
- Using single quotes instead of double quotes around strings and keys
- Leaving a trailing comma after the last item in an object or array
- Adding comments, which standard JSON does not support at all
- Forgetting quotes around keys, a habit carried over from plain JavaScript objects
- Using
undefinedinstead ofnull, sinceundefinedisn't valid JSON
Why these rules exist
JSON was designed to be strictly parseable across every language, which means it sacrifices some of the flexibility of JavaScript object literals in exchange for absolute predictability when different systems read the same file.
Catch mistakes before they ship
Running your JSON through a validator before committing it to a config file or sending it in a request catches all of these issues instantly, pointing to the exact line and character where the syntax broke the rules.
Ready to try it? Jump back up to the JSON Formatter & Validator.