How can I get the value of json object using a series of keys stored in a string. So in this object :
var data = {
"user":{
"profiles":{
"facebook":{
"id":765764
}
}
}
}
I can reference the facebook object this way :
data.user.profiles.facebook; // = Object{id: 765764}
but what if I have the keys saved in a string like this :
var key = "user.profiles.facebook";
data[key]; // does not work unless the string contains only one key.
I need to reference the object where I can modify/change it.
data[key]= {};// for example
How can I do it ?