var twitchProfile = {};
request("https://api.twitch.tv/kraken/users/magnaboyy.json?client_id=8gkbch3ffqj35c1ccx088b9j6leifs8", function (error, response, body) {
const TwitchURL = body;
var jsonContent = JSON.parse(TwitchURL);
twitchProfile.display_name = (jsonContent.display_name);
twitchProfile.id = (jsonContent.id);
twitchProfile.name = (jsonContent.name);
twitchProfile.created_at = (jsonContent.created_at);
twitchProfile.logo = (jsonContent.logo);
console.log(twitchProfile);
In my code, I am grabbing the HTML body of the page (which is the json object) and then i am parsing each key in the object as a key in a JS object, considering I dont want to change anything in the names of the keys, or the content of the object, is there a way to convert the entire object over in one go, instead of all the components of it at a time? If not, am I doing it in a good way?