What is JSON?

JSON, or JavaScript Object Notation, is a lightweight, text-based data format used for storing and exchanging data between systems.

JSON easy to read and write for humans and simple to parse and generate for machines.

JSON is language-independent, making it a popular choice for web development, APIs, and configuration files.


Key Features of JSON:

  1. Lightweight: Minimal syntax and compact structure.
  2. Human-readable: Easy to understand for developers.
  3. Language-independent: Compatible with most programming languages.
  4. Highly Structured: Supports nested data like objects and arrays.
  5. Widely Supported: Found in web APIs, databases, and configuration systems.

JSON Structure

JSON is composed of key-value pairs and supports:

  • Objects: Enclosed in curly braces {}, representing a collection of key-value pairs.
  • Arrays: Enclosed in square brackets [], representing ordered lists of values.

Example JSON:

Consider the following example JSON object.

</>
Copy
{
  "name": "Arjun",
  "age": 25,
  "isStudent": false,
  "hobbies": ["reading", "traveling", "coding"],
  "address": {
    "street": "456 Elm Street",
    "city": "Boston",
    "zipCode": "02134"
  }
}
Example for JSON Structure

In this example:

  • Keys like "name" and "age" are paired with their corresponding values.
  • Arrays like "hobbies" list multiple values.
  • Nested objects like "address" store related information in a structured way.