What is JSON?
JSON (JavaScript Object Notation) is a lightweight, language-independent data interchange format. It is easy for humans to read and write, and easy for machines to parse and generate.
JSON Syntax Rules
Valid Syntax
- •Data is in name/value pairs.
- •Keys MUST be enclosed in double quotes.
- •Strings must use double quotes.
- •Data is separated by commas.
Common Errors
- ×Trailing comma after the last element.
- ×Using single quotes instead of double quotes.
- ×Missing closing braces or brackets.
- ×Adding comments.
Common Use Cases
Web APIs (REST/GraphQL)
Standard format for API data exchange.
Configuration Files
Settings storage (package.json, etc.).
NoSQL Databases
Data storage in MongoDB, CouchDB.