JSON (JavaScript Object Notation) is the lingua franca of the modern web. It is how browsers talk to servers, how APIs return data, and how configuration is stored across countless tools. Despite its simplicity, small mistakes cause big headaches.
The building blocks
JSON has just six value types: strings, numbers, booleans, null, arrays and objects. Objects are unordered key/value pairs wrapped in braces; arrays are ordered lists wrapped in brackets.
{
"name": "Ada",
"active": true,
"skills": ["math", "code"],
"manager": null
}The mistakes that break parsers
- Trailing commas — valid in JavaScript, invalid in JSON.
- Single quotes — JSON strings must use double quotes.
- Unquoted keys — every key must be a quoted string.
- Comments — JSON has no comment syntax.
Formatting for humans and machines
Pretty-print JSON when you are reading it, and minify it when you are shipping it. Indentation makes structure obvious during debugging, while minification removes whitespace to shrink payloads in production.