I have an object which contains data from a WordPress API endpoint. All I want from it is the user's name. But to do that I have to iterate through the following hierarchy:
array [
object {
object {
"name": foo
}
}
]
I tried variations on this but it's not returning what I need.
const userList = Object.values(this.state.userList[0]).map(value => {
const newUserList = Object.values(value).map(value => {
return value[name];
});
return newUserList;
});
What's the proper way to navigate an object tree like that?