JSON (JS Object Notation)
- a text-based data format inspired by js object literal syntax
- Easy for humans to read and write
- Key value pairs are the fundamental building blocks where data is stored as pairs of keys and values
{“name”: “Alice”, “age”: 25, “isStudent”: true}
- It suppports strings, numbers, booleans, arrays, objects, and null
- Objects: Enclosed in curly braces {}, represent a collection of key-value pairs
{“person”: {“name”: “Bob”, “age”: 30}}
- Arrays: Ordered list of values enclosed in square brackets []
{“fruits”: [“apple”, “banana”, “orange”]}
- JSON is commonly used to represent structured data, such as user information
{ “user”: { “name”: “Eve”, “age”: 28, “email”: “eve@email.com” } }
- API (Application Programming Interface):
- APIs enable different software systems to communicate. JSON is commonly used for data exchange in API interactions.
- HTTP Requests: APIs often use HTTP requests (GET, POST, etc.) to send and receive data.
- Response Format: APIs typically respond with JSON-formatted data.
{ “status”: “success”, “data”: { } }