How could we access data from following json response?

{
“response”:
[
{
“leagueName”: “Premier League”,
“startTime”: “1685286000000”,
“venueName”: “Emirates Stadium”,
“venueCity”: “London”
},
{
“leagueName”: “Premier League”,
“startTime”: “1685286000000”,
“venueName”: “Villa Park”,
“venueCity”: “Birmingham”
}
]
}

Is this the correct way?

[‘response’][0]. venueName

Hi @yash_mehrotra,

Let’s say your object holding the parsed JSON is called data, then it would be something like this:

data.response[0].venueName;
1 Like

@Leonidas like this?

pc.http.get(“https://some-link”, function (err, data) {
console.log(data);
console.log(data.response[0].venueName);
});

You would probably want to parse your data first and store it using the code below.

var data=JSON.parse(data)

you could also use XMLHttpRequest()