I have a map of objects which I want to convert to an array of objects.
The map looks as follows, using each objects id as a key:
{
'a' : {
id ' a',
name : 'Andrew'
},
'b' : {
id : 'b',
name : 'Barry'
},
'c' : {
id: 'c',
name: 'Caroline'
}
}
and I would like to convert it an an array:
[
{
id: 'a',
name : 'Andrew'
},{
id: 'b',
name : 'Barry'
},{
id : 'c',
name: 'Caroline'
}
]
preferably using vanilla js, but I use lodash in my application so I have access to that library.
Could someone point me in the right direction please?
Object.values(o);