# \[Solved\] How to Access Property in Object from WEBAPI

**URL:** <https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051>\
**Category:** Questions about Thunkable X\
**Tags:** solved\
**Created:** [March 2, 2020, 2:39pm UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051 "2020-03-02T14:39:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrisanderson1006tt9](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@chrisanderson1006tt9](https://community.thunkable.com/u/chrisanderson1006tt9)\
**Post date:** [March 2, 2020, 2:39pm UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/1 "2020-03-02T14:39:41Z")

</div>

Hey there,

I’m getting “undefined” when trying to access the property of an Object in the API response when setting the text value of a label, if I don’t use a List component. If I use a List component, I cannot get the text to change at all. Either way, I cannot access the property value. Please can someone help?

So far I’ve watched the YT tutorials, read this: [Can't get properties from list object](http://community.thunkable.com/t/cant-get-properties-from-list-object/370497) and this [JSON to List Help - #11 by Mark](http://community.thunkable.com/t/json-to-list-help/47409/11) but without success as I’m not sure what I’m doing wrong.

Here’s how it looks:

This is the URL being called: [https://jsonplaceholder.typicode.com/comments?id=1](https://jsonplaceholder.typicode.com/comments?id=1)  
And this is the response:  
[  
{  
“postId”: 1,  
“id”: 1,  
“name”: “id labore ex et quam laborum”,  
“email”: “Eliseo@gardner.biz”,  
“body”: “laudantium enim quasi est quidem magnam voluptate ipsam eos\ntempora quo necessitatibus\ndolor quam autem quasi\nreiciendis et nam sapiente accusantium”  
}  
]

I know the URL works as I can set the text of the label to just be the raw response and this works every time. Screenshot of response in app and blocks if I just sent the label text to be the response

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

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

But…

When the blocks are like this, the text of the label becomes “undefined”

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

When the blocks are like this, the text of the label does not change

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

I’ve tried replacing the get property “email” with a string block and typing in ‘email’, changing the list number/counter to 0 and 2 (in case there is an index issue) and a few other variations but I do not know how to access the property of an object.

Please could you advise what I’ve done wrong and how I can debug this (to help myself) so that I can get the object property value and use lists correctly with the API call?

Thanks in advance

PS. Full disclosure, I did originally open a topic on this here [WebAPI Cannot access property](http://community.thunkable.com/t/webapi-cannot-access-property/483365) which was marked as resolved but this was down to the API itself not working. Now the API is definitely up, I still cannot get the code to work hence the new thread. Thanks

---

<div class="post-metadata">

**Author:** ![actech](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@actech](https://community.thunkable.com/u/actech)\
**Post date:** [March 2, 2020, 6:15pm UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/2 "2020-03-02T18:15:30Z")

</div>

Hi,

First you need to get the list item, and then the object, and not Vice versa as you do.

---

<div class="post-metadata">

**Author:** ![Daniel\_Coglitore](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Daniel\_Coglitore](https://community.thunkable.com/u/Daniel_Coglitore)\
**Post date:** [March 2, 2020, 6:24pm UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/3 "2020-03-02T18:24:44Z")

</div>

This “[]” in the responds means that is a list ! and an advice you can always use “get object properties of” to help you wich objects to request

---

<div class="post-metadata">

**Author:** ![chrisanderson1006tt9](https://avatars.discourse-cdn.com/v4/letter/c/5f8ce5/32.png) [@chrisanderson1006tt9](https://community.thunkable.com/u/chrisanderson1006tt9)\
**Post date:** [March 2, 2020, 7:13pm UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/4 "2020-03-02T19:13:14Z")

</div>

Thanks @actech and @Daniel_Coglitore. Your responses helped me to fix it! For anyone else struggling, here are the working blocks to set the label text to be the value of the email property 🙌

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/0/90015807b30332d369dcce6d6495f4109101b9e1.png)

---

<div class="post-metadata">

**Author:** ![alekdrajatf](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/alekdrajatf/32/52378_2.png) [@alekdrajatf](https://community.thunkable.com/u/alekdrajatf)\
**Post date:** [May 14, 2020, 10:23am UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/6 "2020-05-14T10:23:34Z")

</div>

I tried for this api link

**[https://api.coinlore.net/api/ticker/?id=1](https://api.coinlore.net/api/ticker/?id=1)**

to take **price\_usd**

not working. any idea why???

Daniel please help me with this API [https://exmarkets.com/api/trade/v1/market/ticker/DDK-usdc](https://exmarkets.com/api/trade/v1/market/ticker/DDK-usdc)  
show on browser like this: {“last”:“2.16500000”,“high”:“2.19000000”,“low”:“1.75710000”,“volume”:“148.82300000”,“bid”:“1.80200000”,“ask”:“2.15990000”}

I tried already with your metode above but failed. I need to pick the “last” price

---

<div class="post-metadata">

**Author:** ![domhnallohanlon](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/domhnallohanlon/32/29554_2.png) [@domhnallohanlon](https://community.thunkable.com/u/domhnallohanlon)\
**Post date:** [May 14, 2020, 10:27am UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/7 "2020-05-14T10:27:49Z")

</div>

Take a look at this more recent topic @alekdrajatf

> [@\[Solved\] Using web api. Get value from JSON?](http://community.thunkable.com/t/solved-using-web-api-get-value-from-json/565173):
>
> I have just started toying with this feature I have a json file and i have put together and pulled apart many blocks trying to get this to work and feeling a little lost and overwhelmed, can anyone assist? Here is what I am trying to achieve: I am trying to get the highlighted figure into a label. Here is my latest unsuccessful attempt:

@eoinparkinson and @jared have done a great job explaining how to parse a JSON response.

If you can’t get it working, please create a **new** topic, as the issue might be specific to the Coinlore API.

Thanks

---

<div class="post-metadata">

**Author:** ![alekdrajatf](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/alekdrajatf/32/52378_2.png) [@alekdrajatf](https://community.thunkable.com/u/alekdrajatf)\
**Post date:** [May 14, 2020, 10:57am UTC](https://community.thunkable.com/t/solved-how-to-access-property-in-object-from-webapi/494051/8 "2020-05-14T10:57:14Z")

</div>

Thanks. I’ll go there

---

<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/solved-how-to-access-property-in-object-from-webapi/494051/9 "2024-11-08T11:29:11Z")

</div>


