So I don't know why Im struggling with this. It seems like I should be able to use Lodash or something to do this I would think.
I have an object that looks like.
{ "fdjkafdajkfasfjkdaslj": {
"-LMUD-2APhiSLkEtVbM": {
"profileName": "bob",
"profilePic": "www.profilepic.com",
"score": 73,
"teamName": "lzs"
}
}
}
I will not know the first to keys in the structure. Example from above.
"fdjkafdajkfasfjkdaslj" or "-LMUD-2APhiSLkEtVbM".
I really just need to push these key values into an array.
"profileName": "bob",
"profilePic": "www.profilepic.com",
"score": 73,
"teamName": "lzs"
What is the best way to accomplish this in javascript (im actually a React.js)? I was thinking Lodash maybe but haven't found anything yet? Most of my searches for retrieving nested Key/Value data in Json indicate you would need a path but I will not have the path in this scenario. I won't know the top 2 keys in this object. The only thing I have is this predicable object structure with 2 unknown keys before my key/value data.