Skip to content
JSON

Nested Objects

Objects within objects for hierarchical data.

By EZ4Code Team
objectnesting

Code

{
  "user": {
    "id": 1,
    "name": "Alice",
    "address": {
      "street": "123 Main St",
      "city": "Springfield",
      "geo": { "lat": 39.8, "lng": -89.6 }
    }
  }
}

Explanation

Objects can be nested arbitrarily deep to model hierarchical data such as users with addresses and coordinates. Each level is a key-value map enclosed in braces. Deep nesting trades readability for structure, so flatten when consumers only need leaf values.

More JSON Snippets