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
    }
  ]
}

Why Use JSON?

  1. 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:

  2. Easy to Parse:

  3. Lightweight:

  4. Interoperability:

  5. Readable Format:

Where JSON is Used:

  1. Web Development:
  2. APIs:
  3. Databases:
  4. Configuration Files: