# How do you get a nested json object from an array

**URL:** https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870
**Category:** Questions about Thunkable X
**Created:** [May 5, 2020, 9:41pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870 "2020-05-05T21:41:41Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![ochapple](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@ochapple](https://community.thunkable.com/u/ochapple)
#### Post date: [May 5, 2020, 9:41pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/1 "2020-05-05T21:41:41Z")

</div>

Hi all,

I’ve seen various ways to extract json data using Get Object and I can get a single Object’s field values, however, I don’t seem to be able to access a nested object’s value or run any debug, I just get undefined.

Here is the JSON where I simply want to extract the second ‘field4’ value which seems to be inside a 3rd nested JSON object in the array.

This JSON Data is actually only 1 Result set not a set of 2 result sets.

{“channel”:{“id”:860888,“name”:“Salt Level Checker”,“description”:“Distance ToF - Salt Level Checker in mm”,“latitude”:“0.0”,“longitude”:“0.0”,“field1”:“Distance”,“field2”:“Charge”,“field3”:“Voltage”,“field4”:“Battery”,“created\_at”:“2019-09-09T19:02:32Z”,“updated\_at”:“2019-11-04T22:01:26Z”,“last\_entry\_id”:314},“feeds”:[{“created\_at”:“2020-05-03T12:20:48Z”,“entry\_id”:314,“field4”:“929”}]}

What I want to get is the last ‘field4’ value which is ‘929’ but I cannot seem to do it with GetObject.  
I also can’t tell whether I am retrieving the second created\_at entry or the first one.

This is my stab at it that is giving me undefined on the last Get Object for the set ADCValue which I want to set to the field4 value 929:-

 ![Screen Shot 2020-05-05 at 22.37.28](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/b/ebfd1e87fb2200ab447e8fb788989e25ab5ebf9a.png)

I would be most grateful to anyone who can help me here

---

<div class="post-metadata">

### Author: ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)
#### Post date: [May 5, 2020, 10:12pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/2 "2020-05-05T22:12:37Z")

</div>

> [@ochapple](#):
>
> {“channel”:{“id”:860888,“name”:“Salt Level Checker”,“description”:“Distance ToF - Salt Level Checker in mm”,“latitude”:“0.0”,“longitude”:“0.0”,“field1”:“Distance”,“field2”:“Charge”,“field3”:“Voltage”,“field4”:“Battery”,“created\_at”:“2019-09-09T19:02:32Z”,“updated\_at”:“2019-11-04T22:01:26Z”,“last\_entry\_id”:314},“feeds”:[{“created\_at”:“2020-05-03T12:20:48Z”,“entry\_id”:314,“field4”:“929”}]}

I’ll take a better stab at this later. But a question is where does the Json come from? Are you able to read any of the values provided?

---

<div class="post-metadata">

### Author: ![ochapple](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@ochapple](https://community.thunkable.com/u/ochapple)
#### Post date: [May 5, 2020, 10:19pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/3 "2020-05-05T22:19:36Z")

</div>

Hi Jared, yes I am able to GET a few values.

This is the actual URL of the JSON: [https://api.thingspeak.com/channels/860888/fields/4.json?results=1](https://api.thingspeak.com/channels/860888/fields/4.json?results=1)

I’m pulling back ‘Salt level checker’ for the first set (JSONName) GetObject  
I am pulling back ‘battery’ for the second (JSONFieldName) GetObject  
I am pulling ‘2019-09-09T19:02:32Z’ from ‘created\_at’ in the 3rd (JSONTimeDate) Get Object  
I cannot pull field4’s value 929 at the end of the string (in a nested object)

Thanks Oliver

---

<div class="post-metadata">

### Author: ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)
#### Post date: [May 5, 2020, 10:23pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/4 "2020-05-05T22:23:29Z")

</div>

Something to look at would be my example app for dealing with just this thing. It’s called nestDLstR

Find it here

> **[jaredgibb.xyz](http://jaredgibb.xyz/thunkable/sample-apps/)**
>
> This domain may be for sale!

---

<div class="post-metadata">

### Author: ![ochapple](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@ochapple](https://community.thunkable.com/u/ochapple)
#### Post date: [May 5, 2020, 10:24pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/5 "2020-05-05T22:24:24Z")

</div>

Thanks Jared, I’ll take a look and post back if I have a question or success!  
Oliver

---

<div class="post-metadata">

### Author: ![ochapple](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@ochapple](https://community.thunkable.com/u/ochapple)
#### Post date: [May 5, 2020, 10:31pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/6 "2020-05-05T22:31:35Z")

</div>

Hi Jared,  
I cannot find nestDLstR but did find NestdList - however that one doesn’t have any JSON and getObjects in it. Sorry, am I missing something? I tried searching for nestDLstR too, but no joy.  
Oliver

---

<div class="post-metadata">

### Author: ![ochapple](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@ochapple](https://community.thunkable.com/u/ochapple)
#### Post date: [May 5, 2020, 10:42pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/7 "2020-05-05T22:42:02Z")

</div>

What this JSON appears to have is 2 x Objects and 1x List, but the list is in the second Object so I cannot seem to reference that. I would love to understand how to reference different objects and lists within objects.

---

<div class="post-metadata">

### Author: ![jared](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jared/32/138473_2.png) [@jared](https://community.thunkable.com/u/jared)
#### Post date: [May 5, 2020, 11:07pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/8 "2020-05-05T23:07:59Z")

</div>

If that doesn’t work, I need to fix it 🤣

I’ve named it a couple ways. Sorry for the confusion.

---

<div class="post-metadata">

### Author: ![ochapple](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@ochapple](https://community.thunkable.com/u/ochapple)
#### Post date: [May 9, 2020, 8:32pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/9 "2020-05-09T20:32:32Z")

</div>

help help anyone?

---

<div class="post-metadata">

### Author: ![dhelix](https://avatars.discourse-cdn.com/v4/letter/d/ee59a6/32.png) [@dhelix](https://community.thunkable.com/u/dhelix)
#### Post date: [April 4, 2021, 2:59pm UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/11 "2021-04-04T14:59:07Z")

</div>

this thread is old, but i ran into the same trouble of trying to read from thingspeak. This was my solution.

the field4 you’re looking for isn’t in a 3rd nested JSON, it’s just in the feeds array \> field4.

This is the URL I used to read from my field6:  
[https://thingspeak.com/channels/######/fields/6.json?results=1](https://thingspeak.com/channels/######/fields/6.json?results=1)

 ![Screenshot 2021-04-04 224418](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/0/40af95129a855a42e8897c6289eaaf70198ebc17.png)

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [November 8, 2024, 11:29am UTC](https://community.thunkable.com/t/how-do-you-get-a-nested-json-object-from-an-array/564870/12 "2024-11-08T11:29:18Z")

</div>


