So I'm having an issue figuring how to reference a variable in JSON dot notation in a meteor application. In doing respJson.userlower.name, userlower is not recognized as a variable. Is there anyway to get around this? The reason I need to have userlower as a variable is because it is being passed into this function and contains the username. And the JSON data that I am getting returns like so:
{"tiandi":{"id":19888066,"name":"Tiandi","profileIconId":7,"summonerLevel":30,"revisionDate":1416925919000}}
try {
var result = HTTP.get(url, function(err, result){
console.log(result);
if (result.statusCode == 200) {
var userlower = userName.toLowerCase();
var respJson = JSON.parse(result.content);
console.log("response received.");
GameList.insert({
IGN: respJson.userlower.name,
level: respJson.userlower.summonerlevel,
Game: "League of Legends"
});
}
});
} catch (e) {
console.log(e);
}