# Error checking Get Property of Object

**URL:** <https://community.thunkable.com/t/error-checking-get-property-of-object/1378843>\
**Category:** Questions about Thunkable X\
**Tags:** webapi, json\
**Created:** [July 5, 2021, 2:29am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843 "2021-07-05T02:29:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpokrzywinskimc6ua](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@mpokrzywinskimc6ua](https://community.thunkable.com/u/mpokrzywinskimc6ua)\
**Post date:** [July 5, 2021, 2:29am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/1 "2021-07-05T02:29:15Z")

</div>

Hello - I am building an app that calls the [https://civicinfo.googleapis.com/civicinfo/v2/representatives](https://civicinfo.googleapis.com/civicinfo/v2/representatives) api. Depending on what the user enters in the input field, when it is used as a parameter to the api, sometimes the resulting JSON will not contain all the properties. Then when I call ‘get property of object’ with the expected property name, the app crashes. How do I capture the exception or query on the property without the application crashing?

---

<div class="post-metadata">

**Author:** ![jaythemanchs](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jaythemanchs/32/92809_2.png) [@jaythemanchs](https://community.thunkable.com/u/jaythemanchs)\
**Post date:** [July 5, 2021, 2:46am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/2 "2021-07-05T02:46:25Z")

</div>

Try this

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

Happy Coding

---

<div class="post-metadata">

**Author:** ![Balanced\_Kitchen](https://avatars.discourse-cdn.com/v4/letter/b/839c29/32.png) [@Balanced\_Kitchen](https://community.thunkable.com/u/Balanced_Kitchen)\
**Post date:** [July 5, 2021, 5:33am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/3 "2021-07-05T05:33:54Z")

</div>

this also works  
 ![object](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/5/25cee91b649bbb61e69fa107917ef754503c2019.jpeg)

---

<div class="post-metadata">

**Author:** ![codeswept](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/codeswept/32/87755_2.png) [@codeswept](https://community.thunkable.com/u/codeswept)\
**Post date:** [July 5, 2021, 6:06am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/4 "2021-07-05T06:06:47Z")

</div>

Could you share your code so we can see where you went wrong?

---

<div class="post-metadata">

**Author:** ![emma0122](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/emma0122/32/108510_2.png) [@emma0122](https://community.thunkable.com/u/emma0122)\
**Post date:** [July 5, 2021, 6:20am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/5 "2021-07-05T06:20:41Z")

</div>

Please share your code so that glitches can be fixed, and yeah the link is showing error too, please fix this as well.

---

<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:** [July 5, 2021, 10:57am UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/6 "2021-07-05T10:57:36Z")

</div>

@mpokrzywinskimc6ua  
There is no easy way to know if the property exists or not. The workaround presented by @jaythemanchs and @Balanced_Kitchen actually works but will make your code too long and too involved.

The best workaround I found is to use  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/c/1c7271cc7836e8cb96825ff833c373bb52d37463.png)  
which will give you a list of all properties in the object. You can then easily check the availability by using the blocks in the list drawer  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/6/d677e476afd242c7666337b6311fc331b3566635.png)  
which you can verify all required properties before displaying the contents.

With this method you can have a function that does the checking of all required properties and then you display the values of those available properties only.

---

<div class="post-metadata">

**Author:** ![mpokrzywinskimc6ua](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@mpokrzywinskimc6ua](https://community.thunkable.com/u/mpokrzywinskimc6ua)\
**Post date:** [July 5, 2021, 1:29pm UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/7 "2021-07-05T13:29:11Z")

</div>

Thank you! This did work, @jaythemanchs, to catch the error when the properties are not part of the returned JSON.

 ![Working Error Checking](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/f/ff927c3edf24f16043767b31051d528f11e57561.jpeg)

---

<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:19pm UTC](https://community.thunkable.com/t/error-checking-get-property-of-object/1378843/8 "2024-11-08T13:19:56Z")

</div>


