Basically i am trying to grab data from the Bungie API i've been successful up until now. I am trying to read this JSON file. http://prntscr.com/k3tin3
But i'm unsure of how to grab a node from the json then use it to request character data?
This has been my best guess so far and it clearly doesn't work, What am i missing? :/
$.ajax({
url: "https://www.bungie.net/Platform/Destiny2/4/Profile/" + searchField + "/?components=100,200",
headers: {
"X-API-Key": apiKey
}
}).done(function(json){
if(JSON.stringify(json.Response.profile.data.characterIds[0])){
var char_slot_0 = JSON.stringify(json.Response.profile.data.characterIds[0]).replace(/[\"\"]/g, "");
var char_slot_0_class = JSON.stringify(json.Response.characters.data.+ char_slot_0 +.classType);
}
});
Currently grabbing characterIds is working fine, It's the second line i can't get to work. Do i need to make another call instead of doing them in the same call?
Edit: I am trying to use the result variable char_slot_0 which returns: 2305843009303234831. To put as a node in the new json stringify request.