# How to get JSON ID from an JSON Object

**URL:** https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886
**Category:** Questions about Thunkable X
**Created:** [July 14, 2023, 11:05pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886 "2023-07-14T23:05:50Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 14, 2023, 11:05pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/1 "2023-07-14T23:05:51Z")

</div>

> [@How do get the first element of this JSON](https://community.thunkable.com/t/how-do-get-the-first-element-of-this-json/139921):
>
> [Capture%202019-07-11\_3] I have this Firebase database structure that I am trying to import into my app. How do I get the first element “van1” without explicitly calling van1 but usin in list get #1? I have googled for several hours now and I’m still at a lost. I trying to get the Brand name of van1. Can anyone point me in the right direction on how to access this JSON object. It’s not a array of objects. I think that’s where I have the problem. I need the JSON to be [{},{}] and not {{},{}}

The above question posed in 2019 has an elaborate method to do what I want. My hope is in the past 4 years there might be a simpler way to do it, like “get json object id”. Following is the JSON object:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/c/7c0f41deab97ab776f88725b2c3d7679418d519e.png)

In this I want a list generated looking like this: [temperature, wind, description, forecast[{day, temperature, wind}, {day, temperature, wind},{day, temperature, wind}]. Basically I am accessing a URL where I don’t know what ID’s to expect. First I need to get the ID then its properties. My sample program:  
[https://x.thunkable.com/copy/27fc62089b7682081e0e32cdc099afbb](https://x.thunkable.com/copy/27fc62089b7682081e0e32cdc099afbb)

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 15, 2023, 3:39am UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/2 "2023-07-15T03:39:59Z")

</div>

if you are trying to write a general purpose routine for converting ANY json string tnto a list, which could contain another list as an item, etc, using thunkable - good luck!

while there is indeed a block for getting the variable names (what you call jsonId), there is no way -using thunkable - to determine what data class each item is (ie, string, integer, real, date?).

and the only way to determine if an item is a list, is to obtain the object then get its length - if greater than zero, it’s an array. and you have to be able to that recursively (ie.list of lists of lists of lists … etc).

i was able to convert your json example

```auto
{
  "temperature": "+31 °C",
  "wind": "4 km/h",
  "description": "Sunny",
  "forecast": [
    {
      "day": "1",
      "temperature": "31 °C",
      "wind": "7 km/h"
    },
    {
      "day": "2",
      "temperature": "+32 °C",
      "wind": "20 km/h"
    },
    {
      "day": "3",
      "temperature": "+32 °C",
      "wind": "19 km/h"
    }
  ]
}

```

the same data above is minified into this string

`{"temperature":"+31 °C","wind":"4 km/h","description":"Sunny","forecast":[{"day":"1","temperature":"31 °C","wind":"7 km/h"},{"day":"2","temperature":"+32 °C","wind":"20 km/h"},{"day":"3","temperature":"+32 °C","wind":"19 km/h"}]}`

… into a list using this block:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/8/f8e7c013258c0b7bfd6d4e1a0e73b2cbc80286b8.png)

… and it does its thing and it creates the list in variable rlist but if you display the list, it’s confusing because thunkable doesn’t use any symbol for indicating start or end of arrays.

while you’re expecting this, an array of 4 items where the 4th item is an array of 3 arrays!

`[+31 °C,4 km/h,Sunny,[[1,31 °C,7 km/h],[2,+32 °C,20 km/h],[3,+32 °C,19 km/h]]]`

you get this instead:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/c/ac3a1070980936c9c2d2bf1e0c31b75a60ee68fd.png)

internally, thunkable knows where the items are but you wouldn’t be able to debug it visually because there are no clues where the array starts or end.

for example, this block segment

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/5/d5ec1350a56e94395dd6cd254fc8120348a62842.png)

display the 2nd entry in the forecast array correctly.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/1/51acd3184dc7f506ffd3c6e826ef71c6159622e7.png)

you still have to parse it to get the individual parts of course.

here’s the version i played with:  
[https://x.thunkable.com/copy/8cfb764164ca7d99c79e38dfd9f80331](https://x.thunkable.com/copy/8cfb764164ca7d99c79e38dfd9f80331)  
.

---

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 15, 2023, 1:15pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/3 "2023-07-15T13:15:39Z")

</div>

Thankyou Manyone you have given me lot of good ideas. So in general Thunkable does not have a well known easy way of getting only the JSON ID’s(Or name). My problem is when I access a URL I do not know what name to put in the “get property(xxxx)”. xxxx is unknown and xxxx can change in the given URL and JSON object might have more or less of the JSON ID’s. I cannot assume constant count or name. I will check what you have done and see if I can end up with just the JSON ID’s. Thanks a lot

---

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 15, 2023, 5:23pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/4 "2023-07-15T17:23:20Z")

</div>

Hi Manyone,

The link you sent connects to my own app not to yours. It does say Web\_API\_Test but does not have any new code. Please resend.

thanks  
ananda

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 15, 2023, 8:07pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/5 "2023-07-15T20:07:18Z")

</div>

can you try this?  
[https://x.thunkable.com/copy/510787ff5a0ae776c3cfea6c31bcbd57](https://x.thunkable.com/copy/510787ff5a0ae776c3cfea6c31bcbd57)

---

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 15, 2023, 8:24pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/6 "2023-07-15T20:24:33Z")

</div>

Sorry no I keep getting mine. Please change the name to XXX and reshare it. Thanks

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 15, 2023, 8:53pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/7 "2023-07-15T20:53:50Z")

</div>

sorry about that - how about now  
[https://x.thunkable.com/copy/e5d84bcad29fc721f770d18f3ce6f4b0](https://x.thunkable.com/copy/e5d84bcad29fc721f770d18f3ce6f4b0)

---

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 15, 2023, 9:02pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/8 "2023-07-15T21:02:38Z")

</div>

Got it!! 🙏 🙏 Will use it as my base. When I am done will post the solution.

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 15, 2023, 9:10pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/9 "2023-07-15T21:10:00Z")

</div>

dont forget to use this

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/e/6e59df746580c4faa4f9d1955491cf2688d82129.png)

it will return this:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/e/7ed4c4407a7494311aaae807536197b7d02d99e9.png)

new link (includes above block)  
[https://x.thunkable.com/copy/59bf2cab4612fc317a1b608f67ddb4c4](https://x.thunkable.com/copy/59bf2cab4612fc317a1b608f67ddb4c4)

---

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 25, 2023, 12:54pm UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/10 "2023-07-25T12:54:52Z")

</div>

Hi Manyone,

Thanks for your help, idea and framework, I have to fully working as I want. The URL is very weak and keeps dying so just as you did I have hardcoded the data for a proof of concept.  
[https://x.thunkable.com/copy/9389d7706629447916981d7c4e9fd524](https://x.thunkable.com/copy/9389d7706629447916981d7c4e9fd524)  
The link to the program just does not work despite the fact I have no URL connected to the program. I keep getting the error message of OpenGraph tags. So I have enclosed the image of it.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/c/3c0c536cef7466d4966f162218878582774b86aa.png)  
Thanks again for the help

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 26, 2023, 12:10am UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/11 "2023-07-26T00:10:22Z")

</div>

i don’t understand, when i run your project and click on button , i get the display below… isn’t this the outcome you expect?

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/7/270a3b227c83a241bbeed9254e7d924f78a321ca.png)

---

<div class="post-metadata">

### Author: ![anandavardhana57zwwl](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@anandavardhana57zwwl](https://community.thunkable.com/u/anandavardhana57zwwl)
#### Post date: [July 26, 2023, 12:26am UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/12 "2023-07-26T00:26:19Z")

</div>

Yes I was just reporting back to tell you it is all done and closed. Sorry I had forgotten to click the Solution box. Just now I clicked it. It is all done and closed. Thanks

---

<div class="post-metadata">

### Author: ![manyone](https://avatars.discourse-cdn.com/v4/letter/m/ee59a6/32.png) [@manyone](https://community.thunkable.com/u/manyone)
#### Post date: [July 26, 2023, 12:28am UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/13 "2023-07-26T00:28:24Z")

</div>

great job!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)
#### Post date: [October 24, 2023, 12:28am UTC](https://community.thunkable.com/t/how-to-get-json-id-from-an-json-object/2506886/14 "2023-10-24T00:28:50Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
