Access item in JSON result

后端 未结 3 1006
[愿得一人]
[愿得一人] 2021-01-26 15:56

I am a bit confused as to how access artists name in this JSON result:

{
  \"tracks\" : {
    \"href\" : \"https://api.spotify.com/         


        
3条回答
  •  Happy的楠姐
    2021-01-26 16:24

    artists is a list of dicts, because a track can have many artists. Similarly items is also a list. So for example you can do results['tracks']['items'][0]['artists'][0]['name'], but that will only get you the first artist of the first track.

提交回复
热议问题