How should I work with this JSON format?

Hello there,

I get a response from an API in JSON format, which looks like this :

I need to make a list of all the subjects from every item (red boxes) and display it on a list-viewer. How should I do that? I have tried some things, but it didn’t work out for me - seems like some of my blocks (mainly getProperty & getListItem ones) are not arranged properly…

If you have any idea/advice, please let me know :slightly_smiling_face:
Any help would be appreciated! Thanks a lot!

1 Like

@muneer has a great demo for this. He can probably provide a project link for you.

2 Likes

This is the block of code for getting sub-values.

Tomorrow I can send the project link when I’m using my computer.

1 Like

Hi Kartik,

This looks like you’re working with lists as well as nested properties. The square brackets [ ] indicate that you are working with a list of items.

You will need to get the property data of your JSON response.

data is a list of lists.

For each item in your list data, you will need to get the second item in the list. These will be your subjects.

The blocks should look something like this. If you share your JSON response in text format, I can test it out and confirm what the blocks would look like.

Thanks,
Jane

2 Likes

Thanks a lot, @jane for the idea! Also thanks @tatiang & @muneer for taking a look here!


Luckily, I figured out the solution! I had to experiment with the object blocks for some time, and eventually I stuck upon the solution. Here’s what I did :

In my first try, turns out I didn’t use the get Object from JSON block. Later I tried to add it, and things started working out.

Thanks a lot anyways! :grinning:

4 Likes

That’s great to hear! Thanks for the update :sunny:

1 Like