What Is JSON?
JSON (JavaScript Object Notation) is the dominant data interchange format on the web. APIs return it, config files use it, databases store it, and every programming language can parse it. Understanding JSON thoroughly is a fundamental skill for any developer.
JSON Syntax Rules
JSON has strict syntax rules — even a single misplaced comma will make it invalid:
1. Strings must use double quotes: "name", not 'name'
2. Keys must be quoted strings: {"key": "value"}, not {key: "value"}
3. No trailing commas: {"a": 1, "b": 2}, not {"a": 1, "b": 2,}
4. No comments: JSON doesn't support // or /* */ comments
5. Values can be: strings, numbers, booleans (true/false), null, arrays, or objects
Common JSON Errors
Missing or Extra Commas
The most frequent JSON error. Every value except the last in an object or array must be followed by a comma.
Unquoted Keys
JavaScript allows unquoted object keys ({name: "John"}), but JSON requires them ({"name": "John"}).
Single Quotes
JSON strictly requires double quotes for strings. {'name': 'John'} is invalid.
Trailing Commas
Many languages accept trailing commas, but JSON doesn't. {"a": 1,} will fail to parse.
Formatting Best Practices
Try our JSON Formatter to instantly beautify, minify, and validate your JSON data.
JSON vs. Other Formats
|---------|------|-----|------|
JSON wins in web contexts due to its native JavaScript compatibility, compact size, and universal parser support.