So I've been trying to take some json info out of an API, but when I try to take the JSON object and assign it to an variable, it just doesn't work.
var info = [];
https.get('https://br1.api.riotgames.com/lol/summoner/v4/summoners/by-name/sumname?api_key=',
(res) => {
info.push(res.toString());
res.on('data', (d) => {
info.push(d.toString());
});
res.on('end', () =>{
console.log(info);
});
});
console.log(info);
<code>