# Fetching information for a JSON php.-file

**URL:** <https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979>\
**Category:** Questions about Thunkable X\
**Tags:** json\
**Created:** [July 9, 2018, 3:02pm UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979 "2018-07-09T15:02:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ida\_T](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@Ida\_T](https://community.thunkable.com/u/Ida_T)\
**Post date:** [July 9, 2018, 3:02pm UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/1 "2018-07-09T15:02:39Z")

</div>

![21](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/5/15e65bb63e164a6682798e6557170cb009ea9cb4.png)

Hello,

We are trying to fetch a JSON-object and display it using a list view. However, we struggle with parsing the JSON-object. Please have a look at the attached image. If we’ve understood correctly, Thunkable interprets the JSON-object from the GET-request as a string, which has to be converted to an object using the corresponding function. That one is not supported by the “for each in”-function. The JSON-object as is now will to be parsed by the “for each item j in…”-function, which at the moments moves trough the JSON-object character by character.

What we are trying to accomplish, is getting the JSON from the server, display the keys in a list view, have the user tap one and the select the appropriate value from the JSON-object which is in turn sent back to the server via a new GET-request.

Any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![albert](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/albert/32/4077_2.png) [@albert](https://community.thunkable.com/u/albert)\
**Post date:** [July 9, 2018, 8:22pm UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/2 "2018-07-09T20:22:32Z")

</div>

Hi there. Do you have a picture of the raw output that your JSON object is in? This will help us understand what the appropriate parsing method might be.

Albert

---

<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:** [July 10, 2018, 5:48am UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/3 "2018-07-10T05:48:10Z")

</div>

Hello,

First, you need to check if there is any response from the server at all.

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

If the answer is received, then it is parsed

![webapi2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/d/1d5c088cbfa482b5837bafc612e3379a1dc6d0ad.png)

---

<div class="post-metadata">

**Author:** ![Ida\_T](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@Ida\_T](https://community.thunkable.com/u/Ida_T)\
**Post date:** [July 10, 2018, 6:43am UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/4 "2018-07-10T06:43:14Z")

</div>

Good morning,

The JSON looks as followed:

{“foo”:1,“bar”:2,“biz”:3,“baz”:4,“bang”:5}

We want to loop trough it as display each key as a button in the list viewer. When pressed, the function should return the associated value. As far as we’ve understood, the get property-function only reads one value by giving it the key.

Thank you for your help!

Ida

---

<div class="post-metadata">

**Author:** ![Ida\_T](https://avatars.discourse-cdn.com/v4/letter/i/13edae/32.png) [@Ida\_T](https://community.thunkable.com/u/Ida_T)\
**Post date:** [July 10, 2018, 6:43am UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/5 "2018-07-10T06:43:46Z")

</div>

Thank you! We will try this solution too.

Ida

---

<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:** [July 10, 2018, 7:01am UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/6 "2018-07-10T07:01:18Z")

</div>

In Thunkable X, when parsing JSON, I recommend converting JSON data into a string. In your case, everything is very simple:

1. Delete all parentheses {} and characters " from JSON string.
2. Create a list using the “make list from text with delimiter” block. Use a comma as a delimiter.
3. Organize a loop in the list to get the functionality you need.

---

<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, 12:02pm UTC](https://community.thunkable.com/t/fetching-information-for-a-json-php-file/34979/7 "2024-11-08T12:02:06Z")

</div>


