How to extract info from this JSON

Hi guys, I have a problem with this type of JSON file.
Link
How Can I extract all “name” from this JSON and add them to a List_view?

Thanks for helping me <3

Hi,

When working with this amount of data, filtering is used, rather than displaying all the names in the List Viewer. That is, the list is initially empty, and it is filled in after entering the search string. In this case, you need to set a limit on the output of no more than 100 records, otherwise the List Viewer will work very slowly how does this happen in my example.

See example on scrFinder in Thunkable

2 Likes

Hey @f3c0931448c949, Thanks for reaching out to the community and asking this question! Admittedly, working with JSON and API’s can be very intimidating at first. Really, once you learn how to turn it into a list to work with, it get’s easier to read/filter these. I have only begun to understand how to retrieve my desired informations from these.

So, I was able to filter this differently a little differently. Instead of turning the response into objects, which is admittedly easier looking, I parse the entire list based upon where certain pieces of text show up after splitting the entire response into a list. The entire list populates in seconds on my iPhone 11.

you’ll notice that I used the function type variables almost exclusively. I did this because, as @actech has posted in the past, they work much faster than app/stored type variables. Populating individual card prices from a click in the list viewer is only slightly slow on my phone. I’d love to hear how it runs on your device!

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

giphy (13)

I’d love to see this remixed with a search bar added in! Any takers??

For reference, it’s a 10,000 + item (easily 200,000 words in total) list in Json format that looks like this

2 Likes

Thank you so much for helping me. I will try more soon i can. And also thank you so much for explaing to me the problem when we have a lot of data to store.

<3

1 Like

Jared,
the links does not work anymore?

This app doesn’t exist for me anymore. I deleted it a while back. You should be able to copy the blocks exactly.

1 Like

thanks Jared

Jared,

if you can advice about this. i try to click on list view and place it at text so i can edit or delete.
this is API control also. i only got undefined and for sure my block is not right.


Were you able to get this working?

One thing I’m confused by is that you’re creating a blank object called app register and then assigning it to be the row number of your Airtable spreadsheet. So you’re basically trying to get “row # nothing” from a spreadsheet. Try using an integer for rowNum.

Hello Everyone, I am having a problem extracting data from json. I have tested my api in a browser and got the json data.

[
{
“name”:“Kampala”,
“local_names”:{
“ky”:“Кампала”,
“uk”:“Кампала”,
“en”:“Kampala”,
“ko”:“캄팔라”,
“fr”:“Kampala”,
“cv”:“Кампала”,
“ru”:“Кампала”,
“tg”:“Кампала”,
“bo”:“ཀམ་པ་ལ།”,
“he”:“קמפלה”,
“fa”:“کامپالا”,
“mk”:“Кампала”,
“pl”:“Kampala”,
“ku”:“Kampala”,
“ur”:“کمپالا”,
“zh”:“坎帕拉”,
“bg”:“Кампала”,
“ka”:“კამპალა”,
“ps”:“کامپالا”,
“ar”:“كمبالا”,
“am”:“ካምፓላ”,
“hi”:“कंपाला”,
“ug”:“كامپالا”,
“ht”:“Kanpala”,
“hu”:“Kampala”,
“eo”:“Kampalo”,
“sv”:“Kampala”,
“ta”:“கம்பாலா”,
“mr”:“कंपाला”,
“kn”:“ಕಂಪಾಲಾ”,
“pt”:“Kampala”,
“oc”:“Kampala”,
“so”:“Kambaala”,
“sr”:“Кампала”,
“be”:“Кампала”,
“de”:“Kampala”,
“el”:“Καμπάλα”,
“ja”:“カンパラ”,
“hy”:“Կամպալա”,
“th”:“กัมปาลา”
},
“lat”:0.3177137,
“lon”:32.5813539,
“country”:“UG”,
“state”:“Central Region”
}
]

I tried extracting the json data using this block.

I am trying to get the city name of kampala.
can someone tell me what I am doing wrong?

1 Like

First of all, you are using a post that is 2 years old.

Create a post of your own instead of bumping up old topics.

Second, your JSON is a List so you need to use the list blocks to get the result.

Do this

You should get this
image

Thanks

I have tried what you have suggested.

but I am getting null

When I replace the blocks with the response block, I can see the json data.

I am having problems extracting data from webapi. I can send get request with no problem. I get a what appears to be a json response.

This is the blocks I am using to parse for the name property.

The result I get back is

I know the API is working because when I load the response directly into the label I get this.

The json data looks like this…

[{“name”:“Kampala”,“local_names”:{“ky”:“Кампала”,“uk”:“Кампала”,“en”:“Kampala”,“ko”:“캄팔라”,“fr”:“Kampala”,“cv”:“Кампала”,“ru”:“Кампала”,“tg”:“Кампала”,“bo”:“ཀམ་པ་ལ།”,“he”:“קמפלה”,“fa”:“کامپالا”,“mk”:“Кампала”,“pl”:“Kampala”,“ku”:“Kampala”,“ur”:“کمپالا”,“zh”:“坎帕拉”,“bg”:“Кампала”,“ka”:“კამპალა”,“ps”:“کامپالا”,“ar”:“كمبالا”,“am”:“ካምፓላ”,“hi”:“कंपाला”,“ug”:“كامپالا”,“ht”:“Kanpala”,“hu”:“Kampala”,“eo”:“Kampalo”,“sv”:“Kampala”,“ta”:“கம்பாலா”,“mr”:“कंपाला”,“kn”:“ಕಂಪಾಲಾ”,“pt”:“Kampala”,“oc”:“Kampala”,“so”:“Kambaala”,“sr”:“Кампала”,“be”:“Кампала”,“de”:“Kampala”,“el”:“Καμπάλα”,“ja”:“カンパラ”,“hy”:“Կամպալա”,“th”:“กัมปาลา”},“lat”:0.3177137,“lon”:32.5813539,“country”:“UG”,“state”:“Central Region”}]

I simply want to get the name property so it will say Kampala.

Hi,

Did you try to put the GET OBJECT FROM JSON block BEFORE the GET PROPERTY OF OBJECT?

Like this:

Set test label’s Text to → get object from JSON → get property of object “name” → response

Tried that and still getting “null”

You are pulling an object from a list. So you need to get item one from the response and then get the object from item one then you can access that objects property called name

Are you using the actual API JSON response this time or are you using the text that you posted above? Because the text above has smart quotes and won’t work properly. If you’re testing this with text in a variable as @muneer did, use this version without smart quotes:

[{"name":"Kampala","local_names":{"ky":"Кампала","uk":"Кампала","en":"Kampala","ko":"캄팔라","fr":"Kampala","cv":"Кампала","ru":"Кампала","tg":"Кампала","bo":"ཀམ་པ་ལ།","he":"קמפלה","fa":"کامپالا","mk":"Кампала","pl":"Kampala","ku":"Kampala","ur":"کمپالا","zh":"坎帕拉","bg":"Кампала","ka":"კამპალა","ps":"کامپالا","ar":"كمبالا","am":"ካምፓላ","hi":"कंपाला","ug":"كامپالا","ht":"Kanpala","hu":"Kampala","eo":"Kampalo","sv":"Kampala","ta":"கம்பாலா","mr":"कंपाला","kn":"ಕಂಪಾಲಾ","pt":"Kampala","oc":"Kampala","so":"Kambaala","sr":"Кампала","be":"Кампала","de":"Kampala","el":"Καμπάλα","ja":"カンパラ","hy":"Կամպալա","th":"กัมปาลา"},"lat":0.3177137,"lon":32.5813539,"country":"UG","state":"Central Region"}]

But more importantly, you’re not putting together the two suggestions that have been given in this topic: (1) use the get object from JSON block and (2) use the in list get block. Each of your most recent screenshots uses one of these suggestions but not both which is why this isn’t working for you and you’re getting a null response.

You need to follow @muneer’s example for setting the label’s text exactly and double-check that all of the blocks match:

If you want to combine them another way, you can get the property “[1].name” of object and not use the in list block at all but you still need the get object from JSON block. Using [1] indicates the first list item.

If you’re still stuck, post a screenshot of your updated blocks

2 Likes

This :point_up_2: :point_up_2: :point_up_2: :point_up_2:

Spot on advice and excellent example! Thanks @tatiang

Sorry for such a short response if there I responded while I took a quick break from mowing my lawn :joy:

1 Like