Weather API not working

Hello Campers,
I’m trying to use the Free Code weather API and Although the request is successful I can’ t extract the information from the returned object json , it gives me only undefined … I wounder why
here is my codepen :
Thanks :slight_smile:


try not to grab specific data when you fetch. you’ll have other functions to handle that

I tried this and I checked the console it says that the josn is array(12) and gives each property an index so I tried to print it as array of object… same error!

what are trying to do exactly?

I try to extract information from the returned JSON object ,
so for example how i can know the whether if it’s sunny or rainy ?

arrays start at zero. hence[0]

It gives undefined and bunch of errors in the console.

if you want specific stuff from an object, you use the dot notation. for arrays, you use an index.[0] is json (the data in its entirety) > weather property of the json object > weather is an array, and you are getting the 0th index

or which will return an array defined at the weather property

here is more info about objects

and arrays

Hmm, It works now … seems I was confused about the hierarchical data structure of json object