Error accessing api

I am currently trying to access the ID from this api. When I just ask for the data it returns everything fine:

fetch('https://cors-anywhere.herokuapp.com/https://api.deezer.com/user/4164456382/playlists')
.then(function (response) {
    response.json()
    .then(function (data){
        console.log("Playlists: ", data);
    })
})

However, when I try console logging the id using data[0].id I get an error saying “Uncaught (in promise) TypeError: Cannot read property ‘id’ of undefined”. I have tried searching for other ways to get around it but so far I think that the path is correct. I’m not sure what I am overlooking.

Hello there,

Looking at the data shape, I think you need:

// ....
.then(function (data) {
  console.log(data.data[0].id);
})
//...

Hope this helps

Thank you so much! I completely missed that… I’m really accustomed to seeing the data as the main and then everything else following after. Learned something new!