String, Number, Boolean, Null, Object, Array — exactly six, nothing else.
Common Mistakes That Break JSON
Trailing commas — valid JavaScript, invalid JSON:
{"name": "Ahmed", "age": 28,} — INVALID
Single quotes — JSON requires double quotes:
{'name': 'Ahmed'} — INVALID
Comments — JSON has no comment syntax whatsoever.
Real API Response Example
{
"city": "Karachi",
"temperature": { "current": 34, "unit": "celsius" },
"humidity": 72,
"timestamp": "2025-06-03T14:30:00Z"
}
JSON vs XML vs YAML
| Feature | JSON | XML | YAML |
|---|---|---|---|
| File size | Small | Large | Small |
| Comments | No | Yes | Yes |
| Best for | APIs, data | Documents | Config files |
Validate and format JSON with our JSON Formatter — shows exact error line numbers.