Issue
I am trying to access the "players" array coming from this API i've called in axios, the return looks like this when I am printing response.data:
Now, I thought it would be easy to access it, so I tried(without success):
response.data.players (print out all players)
response.data.players[0] (print out first player)
response.data[0] (maybe get the array?)
What am I doing wrong?
Solution
I have a feeling that response.data
(based on the screenshot you've attached for response.data
) has one more property called response
inside it, which has players
array. Maybe try using response.data.response.players[0]
.
Let me know if that doesn't work so I can make necessary changes to the answer :)
Answered By - Harsh Tuwar Answer Checked By - Candace Johnson (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.