Parsing firebase object javascript -


it might duplicate, sorry couldn't understand (new firebase , js).

i have snapshot firebase, couldn't understand how parse snapshot object.

here code:

var obj = snapshot.val(); console.log(json.stringify(obj)); 

it outputs following:

{"-kpxdfnjet2xld21lzyh":{"chatid":"6qki8xo5vxdrckfd5wqunuktupg2pnqjc87cfnckxykdoymdhh95lck2"}} 

i want -kpxdfnjet2xld21lzyh value in separate variable , chatid separate variable, not able to.

what should do?

to key name , chatid value:

var json = {    "-kpxdfnjet2xld21lzyh": {      "chatid": "6qki8xo5vxdrckfd5wqunuktupg2pnqjc87cfnckxykdoymdhh95lck2"    }  }  (key in json) {    if (!json.hasownproperty(key)) continue;    console.log(key);    console.log(json[key].chatid);  }


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -