# How to handle JSON objects

**URL:** https://community.thunkable.com/t/how-to-handle-json-objects/38283
**Category:** Questions about Thunkable X
**Tags:** json
**Created:** [July 30, 2018, 9:59am UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283 "2018-07-30T09:59:27Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![ddcld](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@ddcld](https://community.thunkable.com/u/ddcld)
#### Post date: [July 30, 2018, 9:59am UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/1 "2018-07-30T09:59:27Z")

</div>

Greetings to the whole community  
I’m enzo and I try to create an app for IOS.  
I have the result of a call WEB\_API the following OUTPUT:  
{“Number” 3, “result”: [{“id”: “1”, “company”, “Pastarella”, “latitude”: “00.608315”, “longitude”: “00.454391”, “kilometers”: " 7.000 “}, {” id “:” 2 “,” company “:” Franco P.za Ugo “,” latitude “:” 00.602234 “,” longitude “:” 00.507638 “,” kilometer “:” 7.000 "}, {“id”: “3”, “company”, “Clock”, “latitude”: “00.625584”, “longitude”: “00.383393”, “kilometers”, “7000”}], “status”: “OK” }  
I would like to put the 3 results in a list.  
with the following cycle I get only the first company then the cycle is interrupted.  
How can I get what was asked.  
Obviously I tried to put the data in a list but without result.  
I thank you in advance for the help.

 ![Schermata%20da%202018-07-30%2011-41-41](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/2/a2eb9285d15650ada4f95f949b4da0c0243c6c72.png)

---

<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 30, 2018, 11:48am UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/2 "2018-07-30T11:48:41Z")

</div>

Hi,

1. Do not use Alert in cycles. To check the values ​​of variables, you can create a helper list or a variable, which is then displayed in the auxiliary Label
2. First, try without a loop to get all three records from the JSON array, changing their index
3. After successfully retrieving the data on the index, create a loop and all the data from JSON array to the list.
4. Display this list using the List Viewer

---

<div class="post-metadata">

### Author: ![ddcld](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@ddcld](https://community.thunkable.com/u/ddcld)
#### Post date: [July 30, 2018, 1:46pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/3 "2018-07-30T13:46:42Z")

</div>

I’ve already tested that if I manually change the get # I can get the results.  
The problem is that I can not get the list of companies to put in the listView, the number could be 1,2,3,4,5 … 100  
thanks in advance for the help.

---

<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 30, 2018, 1:51pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/4 "2018-07-30T13:51:06Z")

</div>

get # when using JSON is not used (this block sometimes produces incorrect indexes in the test live). Show me a block that shows the name of the company with index 2.

Do you understand that your JSON data is an array of objects? But in your code, I do not see a block that returns data on an index from this array.

---

<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 30, 2018, 1:58pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/5 "2018-07-30T13:58:40Z")

</div>

By the way, your JSON data contains an errors. This is an incorrect JSON format with which the Thuinkable X object will not work correctly.

---

<div class="post-metadata">

### Author: ![ddcld](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@ddcld](https://community.thunkable.com/u/ddcld)
#### Post date: [July 31, 2018, 12:14pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/6 "2018-07-31T12:14:20Z")

</div>

I apologize but I was busy for work,  
Here is an image of how I get the company name,  
just replace the number at the bottom of the get #  
if I apply this technique with a for loop I do not get the desired result.  
(I apologize for the language but I translate with google).

 ![Schermata%20da%202018-07-31%2013-57-19](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/9/e97f8c85a56b806a96857c5b02b43b14fd344ab6.png)

---

<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 31, 2018, 12:43pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/7 "2018-07-31T12:43:06Z")

</div>

The problem is the following. The service gives you data in an incorrect JSON format, and you are trying to read this format using blocks that are designed to work with the correct JSON format.

 ![%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/1/610e211ab742eb047c5e036fa9216b3311858026.png)

Now I will try to work with these bad data manually.

---

<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 31, 2018, 12:57pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/8 "2018-07-31T12:57:36Z")

</div>

If you give me a link to your project, then I’ll try to solve the problem.

---

<div class="post-metadata">

### Author: ![ddcld](https://avatars.discourse-cdn.com/v4/letter/d/b5ac83/32.png) [@ddcld](https://community.thunkable.com/u/ddcld)
#### Post date: [July 31, 2018, 3:57pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/9 "2018-07-31T15:57:59Z")

</div>

RESOLVED.  
Json is correct and does not produce any errors.  
I think the error was in the LIST-LIST get #  
Just a LIST Get #  
as image.  
THANKS THANKS TO ALL.  
Thunkable is fantastic  
(((((when it works)))))!  
ENZO

 ![Schermata%20da%202018-07-31%2017-54-16](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/8/f8978c2a2df8545b21aada7a9d84c094d231f613.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, 12:01pm UTC](https://community.thunkable.com/t/how-to-handle-json-objects/38283/10 "2024-11-08T12:01:05Z")

</div>


