Written by Sümeyye Sever (notes I took while creating web development projects)
JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is text-based and uses key-value pairs to represent data.
Example JSON:
{
"user": {
"id": 1,
"name": "John Doe",
"email": "[email protected]"
},
"tasks": [
{
"id": 101,
"title": "Buy groceries",
"completed": false
},
{
"id": 102,
"title": "Read a book",
"completed": true
},
{
"id": 103,
"title": "Write code",
"completed": false
}
]
}
Data Exchange Between Systems: JSON is commonly used to transmit data between a server and a client, for example, in web applications. APIs (like REST APIs) often return data in JSON format.
Example:
Easy to Parse:
json module.JSON.parse() and JSON.stringify().Lightweight:
Interoperability:
Readable Format:
package.json)..eslintrc.json).