The second argument to foreach is not a list. (COVID19 Handbook App)

image


I am getting this error. Please anyone who can help with a solution?

1 Like

The error is self explanatory:
The list that you’re trying isn’t a list. it’s a String.Actually, the website didn’t return a list.

2 Likes


Thanks for your reply. I am working with this API, the previous research i made, I was able to use those blocks to get data from the JSON, why is it different now or how can I solve it. Thanks

what you’re trying to get is not a list, use Do it to debug the error.

First, you can use the dictionaries instead of the lists.I recommend you to use my extension to parse json to dictionaries.Request for JSON decode to dictionary
Second, you’re not getting data from the website right.As i see it returns PNG not what i see.
Third, you can use this guide to learn how to work with dictionaries:
Guide: Dictionary Blocks

1 Like

Okay. Thanks. I have never used Do It before. Don’t know how to, but let me search the forum on how to use it. Thanks again

just right click on the block you’re testing for and select Do it

1 Like


Hey guys, I have corrected the previous error I encountered. I added a wrong URL for it to fetch data from. I have corrected that. Now the data is parsing but is not going into the desired dynamic labels. Can anyone help.


Here is the JSON I am working with

Hey I went through the dictionary link you sent me. I must confess it’s a bit hard for me to understand now. Though I will still take my time and learn it very very well. Meanwhile can you check this my reply about the previous post. Thanks Foreach is not a list error

May be i can give you a sample with dictionaries and you continue.As dictionaries are the most easiest way to work with json apis:

1 Like

Wow thanks so much

1 Like

You’re welcome :smiling_face_with_three_hearts:

1 Like

I have done that with dictionary and I am getting empty list issue


I am so sorry for disturbing your peace

I think you need to add make empty dictionary block in the decoder variable.And make empty list in the other variables.

still same error

Any way, the error is clear.Your list has no items.Debug your blocks and see where is the error. :+1:


with this blocks, I am getting the list but it is not going into the desired dynamic labels

Thanks guys to everyone who gave a reply and assisted in my making of this new app. I am happy to announce to you all that I am fully done with the development. I am so happy to be a part of this kodular community and so happy the way the members assist each other. It shows we will all go far in life.
Below is the AIA file of the app I have been working on and the APK as well for those who want to test it.
Covid19.apk (5.8 MB)
Covid19.aia (398.6 KB)
The app is free and anyone wants to edit the AIA to suit it’s users.

Create a New Topic for it in Koded App category.

1 Like

I changed the title and category.
@Onuorah_Ifeanyi
Next time please write a proper title and select a proper category.
:slightly_smiling_face:

1 Like