Special item from json file

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

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

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.

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

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.

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.


maybe somebody can help how I can change this in a loop.
kindly regards again.

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.

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


Here my project: Thunkable

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

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!

Okay, try this:

https://x.thunkable.com/copy/e2a8da3e6387e7b2210f1a581d1eb44f

1 Like

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.

2 Likes

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
But when the warnstufe text is 4 the background color will not change to blue.
Hope somebody can still help me there.
kindly regards

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


kindly regards

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.

1 Like

it works.
Thanks for the answer.
kindly regards

1 Like