---
title: "How to access items in a nested JSON object?"  
description: "How to access items in a nested JSON object?"  
author: "Utpal Vishwas"  
published: 2023-05-11  
updated: 2023-05-12  
canonical: https://www.mindstick.com/forum/158264/how-to-access-items-in-a-nested-json-object  
category: "json"  
tags: ["json", "jsonobject"]  
reading_time: 2 minutes  

---

# How to access items in a nested JSON object?

How to [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) [items](https://www.mindstick.com/forum/33812/getting-number-of-items-selected-in-uicollectionview-in-ios) in a [nested](https://www.mindstick.com/forum/45/itemcommand-event-in-nested-repeater-and-listview) [JSON object](https://www.mindstick.com/forum/699/how-to-parse-into-json-object-using-json-parse-in-node-js)?

## Replies

### Reply by Aryan Kumar

Accessing items in a nested [JSON](https://www.mindstick.com/forum/34446/convert-json-string-to-object) object can be done by chaining property or index notation to traverse through each level of the object.

Here's an example of a nested JSON object:

```javascript
{
 "name": "John",
 "age": 30,
 "address": {
   "street": "123 Main St",
   "city": "New York",
   "state": "NY",
   "zip": "10001"
 },
 "phone_numbers": [
   {
     "type": "home",
     "number": "555-1234"
   },
   {
     "type": "work",
     "number": "555-5678"
   }
 ]
}
```
To access the value of the `name` property, you can simply use the dot notation like this:
```python
data = {
 "name": "John",
 "age": 30,
 "address": {
   "street": "123 Main St",
   "city": "New York",
   "state": "NY",
   "zip": "10001"
 },
 "phone_numbers": [
   {
     "type": "home",
     "number": "555-1234"
   },
   {
     "type": "work",
     "number": "555-5678"
   }
 ]
}
name = data["name"]
```

To access the `state` property in the `address` object, you can chain the dot notation like this:

```python
state = data["address"]["state"]
```

To access the second phone number's `number` property, you can use the index notation like this:

```python
number = data["phone_numbers"][1]["number"]
```

By using these techniques, you can access any property or value in a nested JSON object.


---

Original Source: https://www.mindstick.com/forum/158264/how-to-access-items-in-a-nested-json-object

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
