I have a list of array of Objects. I need to concat the all the options items into one array.
Here is the sample array of objects.
let data = [
{
name: "group1",
options: [
{
item: "item1",
price: 100
},
{
item: "item2",
price: 200
},
{
item: "item3",
price: 300
}
]
},
{
name: "group2",
options: [
{
item: "item4",
price: 101
},
{
item: "item5",
price: 201
}
]
},
{
name: "group3",
options: [
{
item: "item6",
price: 254
},
{
item: "item7",
price: 358
}
]
}
]
output like:
let options = [
{
item: "item1",
price: 100
},
{
item: "item2",
price: 200
},
{
item: "item3",
price: 300
},
{
item: "item4",
price: 101
},
{
item: "item5",
price: 201
},
{
item: "item6",
price: 254
},
{
item: "item7",
price: 358
}
]