Web API help with square brackets

i am trying to get data from the openweather API, the specific data i am trying to get is “weather.id”. so far i have tried doing get property of object ‘id’ and then linked to get property of object ‘weather’ which links to get object from json that goes into response. this has worked just fine for the other api calls im using such main.temp and main.feels_like. one thing i noticed though was in the api code the weather.id is in square brackets as well as curly brackets. whereas the others are just in curly brackets. ie.
“weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04d”}]
so i guess my question is how do i call stuff inside square brackets with thunkable. thanks in advance

The brackets in JSON indicate a list (aka array).

So for weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04d”}]

You’d need to get the object property “weather” and then get the list item #1 from that value.

Like this:

If instead you had a JSON array with multiple items, like this:

weather”:[{“id”:803,“main”:“Clouds”,“description”:“broken clouds”,“icon”:“04d”},{“id”:955,“main”:“Clouds”,“description”:“scattered clouds”,“icon”:“02d”}]

Then, to get the second array/list info, you would just change the get #1 in the list block above to get #2.

I find it really helpful to copy and paste the JSON result I get into this website for easier formatting: https://jsonformatter-online.com.

1 Like

Thank you so much that was my issue!