javascript - How to extract data from unknown json file? -


i have json file :

{ "moosy": { "id": 39464441, "name": "moosy", "profileiconid": 558, "summonerlevel": 30, "revisiondate": 1436887737000 } }

which generated api. here code :

var http = require('http'); var lolapi = require('leagueapi'); var summonername = 'moosy';  var server = http.createserver(function(req, res) {   res.writehead(200);        lolapi.init('my_very_private_key', 'euw');        lolapi.summoner.getbyname(summonername, function(err, summoner) {           if(!err) {              var profil = json.stringify(summoner);             console.log(profil);             res.write(profil);              var summonerid = profil.summonername.id;             console.log(summonerid);             res.write(summonerid);            }       })   }); server.listen(8080); 

and i'd extract different variables id, name, profileiconid , summonerlevel.

i haven't figured out how json.parse, can me out ? :) i'm using node js.

thanks !

go http://jsonlint.com/ , validate json. see invalid. maybe causing troubles.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - How to Hide Date Menu from Datepicker in yii2 -