# Special item from json file

**URL:** <https://community.thunkable.com/t/special-item-from-json-file/854066>\
**Category:** Questions about Thunkable X\
**Created:** [September 27, 2020, 8:49pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066 "2020-09-27T20:49:15Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [September 27, 2020, 8:49pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/1 "2020-09-27T20:49:15Z")

</div>

Hi!  
I want to get a special item from a json file.  
The url for the json is: [https://corona-ampel.gv.at/sites/corona-ampel.gv.at/files/assets/Warnstufen\_Corona\_Ampel\_Gemeinden\_aktuell.json](https://corona-ampel.gv.at/sites/corona-ampel.gv.at/files/assets/Warnstufen_Corona_Ampel_Gemeinden_aktuell.json)

I want for example the “Warnstufe” from “Name”: “Rust” from the last date.  
Hope somebody can help me how I can solve this.  
kindly regards

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 28, 2020, 2:32am UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/2 "2020-09-28T02:32:18Z")

</div>

This works. You need to test it on a mobile device with Thunkable Live. If you preview it in a web browser, it will give you an error.

Here’s the project: [Thunkable](https://x.thunkable.com/copy/524e165e99bbea9545fe8e8ae6f580ca).

 ![Screen Shot 2020-09-27 at 8.33.13 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/c/bc72ad7365e49ac2ab48706c3e90921633ef0b3a.png)

 ![IMG_D0CACE51BC9F-1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/6/56660ccd1b7e289cbebe7bdc180a0f767bb595f6.jpeg)

---

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [September 28, 2020, 10:37am UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/3 "2020-09-28T10:37:58Z")

</div>

Thanks for the answer and project.  
Is there any possibility to search for an other city for example vienna or graz … to get the actual “Warnstufe”.  
kindly regards again

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 28, 2020, 3:43pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/4 "2020-09-28T15:43:18Z")

</div>

If you’re going to get different data from a JSON file, you really need to understand how they work. I won’t be able to make a demo for each value you need.

There are many tutorials available (I Googled _thunkable json_).

If you are having trouble with something, post a screenshot of your blocks and someone can help you.

---

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [September 28, 2020, 10:02pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/5 "2020-09-28T22:02:56Z")

</div>

Thanks for your answer.  
In my opionion I will need a loop for the name label to change the 2 in an index beginning with 1 to 2095 to search for a special name.

 ![Unbenannt](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/a/8a77152f0b3d0841bed3ecc4a476a21d1efe17af.png)  
maybe somebody can help how I can change this in a loop.  
kindly regards again.

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 29, 2020, 3:01pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/6 "2020-09-29T15:01:11Z")

</div>

How familiar are you with Thunkable? Which loops blocks have you tried already? I think you’re going to need to use the _Count from 1 to length(list)_ by 1 block.

---

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [September 29, 2020, 7:21pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/7 "2020-09-29T19:21:36Z")

</div>

Thanks for the answer.  
I have tried the following code:

 ![thunkable_corona](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/8/68f2de4fd9f1fdb7a5d047a20551be8843e38c0e.png)  
Here my project: [Thunkable](https://x.thunkable.com/projects/5f71a5eea251c564f3d4abd1/57a6b7ed-c075-4536-bb58-1f775c20cdc8/blocks)

But it doesn’t work. Hope somebody can still help me.  
kindly regards

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 29, 2020, 10:45pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/8 "2020-09-29T22:45:26Z")

</div>

That’s a good start! I’m trying to publish some changes I made to what you posted but the publishing server doesn’t seem to be working for me. It just says “Processing…”

Some things I noticed about your blocks:

1. You have “If Status=200” twice. I guess I had that in the original project too. Oops! You only need it once.
2. In your count with i from 1 to 2095 loop, you’re getting the property of list item # _app nr_ but there’s a good chance that _app nr_ will be zero/null many times in that loop. So you need to check to see if _app nr_ ≠ 0 first and then change the label text if it’s not zero. That’s what I was trying to fix and publish to show you.
3. The _from JSON Status label set Text to Done_ block should be at the end of the _If status=200_ section not below it. That was my fault, too!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 29, 2020, 10:51pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/9 "2020-09-29T22:51:10Z")

</div>

Okay, try this:

[https://x.thunkable.com/copy/e2a8da3e6387e7b2210f1a581d1eb44f](https://x.thunkable.com/copy/e2a8da3e6387e7b2210f1a581d1eb44f)

 ![Screen Shot 2020-09-29 at 3.51.03 PM](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/2/82588b3dcd0a0b6e8cc0b1d8ae63d419dcdce631.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [September 30, 2020, 12:08am UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/10 "2020-09-30T00:08:05Z")

</div>

If you know there is only one name that matches your search (“Weiz”), you can make this much faster by adding a _break out of loop_ block from the _Control_ drawer right after the _set app nr to i_ block. So if the JSON record with the name “Weiz” is #15 out of 2095, it will stop when it finds it. In that case, only 15 loop cycles/iterations will have completed instead of the total 2095.

---

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [November 9, 2020, 8:36pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/11 "2020-11-09T20:36:11Z")

</div>

Thanks a lot for your answer.  
I want to upgrade this project and try to change the background-color of the warntufe label regarding to the value.  
I try the following after web\_api get:  
 ![grafik](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/c/1c64b5f8347bff5253f85f3c8af667fc37aff156.png)  
But when the warnstufe text is 4 the background color will not change to blue.  
Hope somebody can still help me there.  
kindly regards

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 9, 2020, 8:42pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/12 "2020-11-09T20:42:52Z")

</div>

Can you share a link to the current version of your project?

---

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [November 9, 2020, 8:44pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/13 "2020-11-09T20:44:32Z")

</div>

> **[Thunkable](https://x.thunkable.com/copy/f89eed1c3e75bca46fc664c23016ae07)**

  
kindly regards

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [November 9, 2020, 9:08pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/14 "2020-11-09T21:08:47Z")

</div>

You need to put the if/do block INSIDE of the Web API blocks’ “then do” section.

The way you have it set up is like telling a kid these three things:

1. “Tell me your name.”
2. “Solve 18 \* 45 \* 3 in your head.”
3. “What’s your favorite color?”

Because they are going to take a while to solve #2, they will probably tell you their name first, then their favorite color, and finally the answer to the math problem.

Web API calls take a little time. But the compiler is going to go right past to the next statement (if/do) unless you either make it wait or you put it inside the “then do” section of the Web API block.

---

<div class="post-metadata">

**Author:** ![haiflosse](https://avatars.discourse-cdn.com/v4/letter/h/7993a0/32.png) [@haiflosse](https://community.thunkable.com/u/haiflosse)\
**Post date:** [November 9, 2020, 11:05pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/15 "2020-11-09T23:05:50Z")

</div>

it works.  
Thanks for the answer.  
kindly regards

---

<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:21pm UTC](https://community.thunkable.com/t/special-item-from-json-file/854066/16 "2024-11-08T12:21:41Z")

</div>


