How can I access nested JSON objects that I get from an api call?

Hi my name is Dimitri and this is my first ever post on the forum. I’m trying to do the weather app challenge and I am having trouble accessing nested objects from the API respond received from Some of the data looks something like this:

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

I don’t have trouble accessing an object that is not nested so when I try json[“name”] or it returns the name of the city (in this case Cairns) as expected.
The problem is when I try to access a nested object, so when I try or main.temp nothing is returned…
Please help I"ve been stuck on this for awhile.
Thank you!!

Note that weather is an array, not a plain object. If you want to get main, you’ll use weather[0].main.

1 Like

Thank you so much!! I didn’t even notice that haha