# Simple Frustating JSON

**URL:** https://community.thunkable.com/t/simple-frustating-json/1430454
**Category:** Questions about Thunkable X
**Tags:** json
**Created:** [August 4, 2021, 1:04pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454 "2021-08-04T13:04:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![darw821k](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@darw821k](https://community.thunkable.com/u/darw821k)
#### Post date: [August 4, 2021, 1:04pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/1 "2021-08-04T13:04:45Z")

</div>

Hello,  
Can someone help, how to get the value of this JSON response?  
I cannot use index position, since the position is not always the same.

So, using the { “attribute\_key” : “value” } is the best.  
My question is, how to filter specific key/value pair, and get the “value” in same JSON child.

For example, if I need to get value of “long\_v”, which is the value for “temperature”.  
I cannot figure this out

```auto
{

    "attribute_kv": [

        {

            "attribute_key": "temperature",

            "long_v": 30,

            "dbl_v": null

        },

        {

            "attribute_key": "cloudCover",

            "long_v": 19,

            "dbl_v": null

        },

        {

            "attribute_key": "solarDNI",

            "long_v": null,

            "dbl_v": 178.23

        },

        {

            "attribute_key": "inactivityTimeout",

            "long_v": 600000,

            "dbl_v": null

        },

        {

            "attribute_key": "refresh_api",

            "long_v": null,

            "dbl_v": null

        },

        {

            "attribute_key": "inv_qty",

            "long_v": 3,

            "dbl_v": null

        },

        {

            "attribute_key": "total_capacity",

            "long_v": 3,

            "dbl_v": null

        },

        {

            "attribute_key": "solarDHI",

            "long_v": null,

            "dbl_v": 65.05

        },

        {

            "attribute_key": "weatherCode",

            "long_v": 1100,

            "dbl_v": null

        },

        {

            "attribute_key": "solarGHI",

            "long_v": null,

            "dbl_v": 149.12

        },

        {

            "attribute_key": "active",

            "long_v": null,

            "dbl_v": null

        },

        {

            "attribute_key": "lastDisconnectTime",

            "long_v": 0,

            "dbl_v": null

        },

        {

            "attribute_key": "lastConnectTime",

            "long_v": 0,

            "dbl_v": null

        },

        {

            "attribute_key": "lastInactivityAlarmTime",

            "long_v": 1628075359929,

            "dbl_v": null

        },

        {

            "attribute_key": "pv_inv_ratio",

            "long_v": null,

            "dbl_v": 1.2

        },

        {

            "attribute_key": "lastActivityTime",

            "long_v": 1628074741182,

            "dbl_v": null

        },

        {

            "attribute_key": "lat",

            "long_v": null,

            "dbl_v": -6.224007000203784

        },

        {

            "attribute_key": "lon",

            "long_v": null,

            "dbl_v": 106.6603225304693

        }

    ]

}

```

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 4, 2021, 1:22pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/2 "2021-08-04T13:22:40Z")

</div>

Attribute\_kv is a list and all the rest values are entries in the list.

I created this sample project from your JSON.

Have a look

[https://x.thunkable.com/projectPage/610a981f8204ae0283e417a8](https://x.thunkable.com/projectPage/610a981f8204ae0283e417a8)

---

<div class="post-metadata">

### Author: ![darw821k](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@darw821k](https://community.thunkable.com/u/darw821k)
#### Post date: [August 4, 2021, 2:51pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/3 "2021-08-04T14:51:31Z")

</div>

Hi Muneer,  
Thank you very much for the help. I did successfully make list output based on your example.  
But, what if I need to display specific value on the “label”.

 ![Screenshot_3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/c/dcb0a62a776c24b7ac192ac46d43171f34a8a636.png)

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 4, 2021, 3:05pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/4 "2021-08-04T15:05:01Z")

</div>

I changed the project and added another `List Viewer` which only shows the **attribute\_key**. When you select any item in the list the other two keys **long\_v, dbl\_v** are displayed in the labels under the list.

Just remix the project to get the changes.

---

<div class="post-metadata">

### Author: ![darw821k](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@darw821k](https://community.thunkable.com/u/darw821k)
#### Post date: [August 4, 2021, 11:53pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/5 "2021-08-04T23:53:00Z")

</div>

Hi Muneer,  
I have try to modify your example to query specific parts of JSON only without success.  
I can easily do this with JSONata attribute\_kv[attribute\_key=‘temperature’].long\_v , but it won’t work on Thunkable.

Would you please help me to make an example?  
Not to show them on list, but on single label.

So, for example, I just want to query “long\_v” value with “attribute\_key : temperature”, and show the value on label, instead list.

Many thanks for your help, I’ve been trying to solve this out for 3 days without success. 🙂

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [August 5, 2021, 10:52am UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/6 "2021-08-05T10:52:10Z")

</div>

The JSON you have is a `List of Objects` and there isn’t an easy way in thunkable to get the values.

If the list is a normal list of entries then you will use

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/b/7badca255f3c3fc29d4c5440a49f2c19d6e5f602.png)  
But this will not work because each entry in the list is actually a JSON object therefore, you will need to loop through all the entries and check if it is the one you want. using this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/c/9c822a2529f0c98a99c8d0485d06affdedec98bc.png)

I have changed in the project to include the test using the loop that creates the 2 lists. You can remix to see it and of course, you can remove the blocks that creates the lists from the loop if all what you want to do is to display this single value.

---

<div class="post-metadata">

### Author: ![darw821k](https://avatars.discourse-cdn.com/v4/letter/d/b5a626/32.png) [@darw821k](https://community.thunkable.com/u/darw821k)
#### Post date: [August 5, 2021, 1:00pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/7 "2021-08-05T13:00:09Z")

</div>

Perfect… It works.  
Thank you very much for the time you’ve spent on this. I greatly appreciate it.

---

<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, 1:17pm UTC](https://community.thunkable.com/t/simple-frustating-json/1430454/8 "2024-11-08T13:17:39Z")

</div>


