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
Post a Comment