Chapter 2 — Organizing Data in JSON
JSON allows objects and arrays to be nested within each other to represent complex data relationships. This hierarchical structure makes JSON suitable for representing real-world systems such as orders, databases, or application configurations.
Example: Nested JSON
{
"order": {
"id": 1001,
"customer": "John Doe",
"items": [
{ "product": "Book", "price": 20 },
{ "product": "Pen", "price": 5 }
]
}
}This example represents an order containing multiple purchased items.