# 'get object from json' issue

**URL:** https://community.thunkable.com/t/get-object-from-json-issue/565179
**Category:** Questions about Thunkable X
**Created:** [May 9, 2020, 3:52pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179 "2020-05-09T15:52:51Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)
#### Post date: [May 9, 2020, 3:52pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/1 "2020-05-09T15:52:51Z")

</div>

Hi all

I’m experienced in app inventor 2 but new to thunkable.

I am trying to read a json which is generated from php script on my website when i press a button.

i am using web\_api GET and if i put the response directly in to label\_text it shows the whole json so it works.

 ![works](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/2/3227ea9d4de224770b6076922b132e1ea681a4c3.png)

but when i use ‘get property of object’ and ‘get object from json’ from the response, the first response always gives a network request failed error. if i press the button again then it works fine and works everytime after that.

 ![notworking](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/e/fe9e8d6dda56036f16274b291e2eff76b4d4a360.png)

if i restart the app, the first attempt always gives the network request failed error. it then works fine if i press the button again.

any help would be appreciated or if this is a bug

thanks

---

<div class="post-metadata">

### Author: ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)
#### Post date: [May 9, 2020, 4:11pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/2 "2020-05-09T16:11:26Z")

</div>

Hi, 👋 & Welcome to Thunkable Community! 🎉

Since you’re an experienced user of AI2, you would soon catch-up with Thunkable too 🙃

* * *

Try to set this block ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/8/481ec38eccc1cc0322ca877fb5d9b320bb77ac58.png) to a variable, and then attach the variable to the ‘get property’ block.

See if it works now.  
Thanks!

---

<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 9, 2020, 5:04pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/3 "2020-05-09T17:04:11Z")

</div>

Hey @captainzee9999jf, we also have this great tutorial series on APIs which @simran developed last year that will help get you up to speed with Thunkable X too!

https://www.youtube.com/embed/videoseries?list=PLB89L9PPGIry11IQq0dyVG_aK6kUMHP1F&wmode=transparent&rel=0&autohide=1&showinfo=1&enablejsapi=1

---

<div class="post-metadata">

### Author: ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)
#### Post date: [May 9, 2020, 5:27pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/4 "2020-05-09T17:27:26Z")

</div>

Thanks guys. Will watch the video and try your suggestion

---

<div class="post-metadata">

### Author: ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)
#### Post date: [May 9, 2020, 6:35pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/5 "2020-05-09T18:35:21Z")

</div>

unfortunately the variable idea didnt work, it was still bringing up the network request failed

---

<div class="post-metadata">

### Author: ![kartik14](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/kartik14/32/44782_2.png) [@kartik14](https://community.thunkable.com/u/kartik14)
#### Post date: [May 10, 2020, 3:14am UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/6 "2020-05-10T03:14:23Z")

</div>

Ok, can you make sure your internet is working properly?  
Also please provide your device details with Android/iOS version.

Thanks!

---

<div class="post-metadata">

### Author: ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)
#### Post date: [May 10, 2020, 11:54am UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/7 "2020-05-10T11:54:00Z")

</div>

The internet is definitely working ok. I’m using a samsung s9+ with android version 10.

I did get the weather app working that was shown in the video above but that now crashes the thunkable live app.

Thanks for any help you can give

---

<div class="post-metadata">

### Author: ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)
#### Post date: [May 10, 2020, 11:57am UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/8 "2020-05-10T11:57:23Z")

</div>

This is the output from the json when I access it through the browser

 ![Screenshot_20200510-125535_Samsung Internet](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/28c526e7b7d288f58a9d9d207a931ac4377e9507.jpeg)

---

<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 10, 2020, 12:49pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/9 "2020-05-10T12:49:22Z")

</div>

That would be just a single object?  
Can you provide a share link?

---

<div class="post-metadata">

### Author: ![eoinparkinson](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/eoinparkinson/32/143769_2.png) [@eoinparkinson](https://community.thunkable.com/u/eoinparkinson)
#### Post date: [May 10, 2020, 12:58pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/10 "2020-05-10T12:58:30Z")

</div>

The [URL](http://darkwars.zootworld.com/darkmark/find2.php) returns:  
`{"name":"Perrin","darkmark":"ZBDVBS"}`

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

Did you try removing the IF statements and just having the set label to darkmark?

Just this block inside of the Web\_API1 block:  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/e/0e0c905b5dd93c459f6d00def3863ee4c2ef6fdb.png)

---

<div class="post-metadata">

### Author: ![captainzee9999jf](https://avatars.discourse-cdn.com/v4/letter/c/49beb7/32.png) [@captainzee9999jf](https://community.thunkable.com/u/captainzee9999jf)
#### Post date: [May 10, 2020, 2:17pm UTC](https://community.thunkable.com/t/get-object-from-json-issue/565179/11 "2020-05-10T14:17:32Z")

</div>

thank you for all your suggestions but i think i have found the issue. I did originally try it without the if statement and still had the same issue.

the web\_API ‘set url’ appears to need a variable either joined to the url text. (blank text box will not do it) or the url to be got from a variable. I copied the weather app from the video above and modified my app to match. Then slowly took off parts I didnt need till it started to fail. Removing the variable input caused the issue.

the pic below shows the code working fine

(this test php i created requires no api key or username/password)

i assume there is a bug or some restriction i am unaware of

 ![works2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/1/f11f0cceecd0c68a1817b5477e8ed7803b6dc692.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/get-object-from-json-issue/565179/12 "2024-11-08T11:29:16Z")

</div>


