I can access a value like driver.my_friends["793659690"].name but now I am using it in a loop where key will hold the key.
driver.my_friends[key].name doesn't work. Says undefined, and driver.my_friends["key"].name will look for a key named key. So how do I use it so that the variable of the variable is evaluated too.
driver.my_friends[key].nameshould work, so most likely whateverkeyyou're iterating through doesn't exist. Try debugging other data yourself or providing more of the surrounding code.driver.my_friends[key].nameis correct. My guess is thatkeyis set to the wrong value. See jsFiddle for a working example.