I have a similar object that looks like this:
{
"name":"sdfsd",
"id":1,
"groups":[
{
"name":"name1",
"id":1,
"subGroups":[..]
},
{
"name":"name2",
"id":21,
"subGroups":[..]
}
]
}
My goal is to create an array with the following structure:
[
{
"name":"name1",
"id":1
},
{
"name":"name2",
"id":21
}
]
Instead of using a loop to manually create the array, I am wondering if there is a more elegant solution in ES6.