Get specific item from object with unknown name? (like 1st item)

I would like to get the value of “name” from the example json object below without knowing the name of the object (123) because this could be anything and I dont know before.

{
“123”: {
“email”: "kato@firebase.com",
“name”: “Kato”
}
}

I know it dont work like this but I look for something like
console.log(object[0].name);

to make it more clear. :slight_smile:

thanks in advance, I realize this is not a ionic issue but I need help with it anyway and thought I ask you guys here.

It’s not an ionic question. You can use StackOverflow for same questions.
Even so,

var data = {
    "123": {
    "email": "kato@firebase.com",
    "name": "Kato"
    }
}

var name;

for (var key in data) { 
    if (data[key].hasOwnProperty("name")) {
        name = data[key].name;
        break;
    } 
}

Thanks, I know this was not ionic issue but I guess there is a bunch of people around here which use ionic/firebase and might have the same situation sooner or later. thx anyway. solved it for me.