I’ve just started to get into JSON with JavaScript but when trying to use this in an actual project all I got for the return was [object Object]
. The code below shows the return I want to get in the variable games
data.
let games = '{"games": [{"name": "PUBG","desc": "Original widely popularised by `The bridge incident.` PUBG is a shooter with many fun modes and distinctive gameplay. "}]}'
JSON.parse(games)
alert(games[0].name);
//Should output PUBG
I don’t know why it won’t return even after using the other questions on it here at Stack. I’ve tried using this question and other sites as a guide: Accessing json objects with no name (Needs to be an alert)