I have a nested object array like below,
data = [
{
"field": "A",
"items": [
{
"Id": 001,
"ItemDescription": "item 1"
}
]
},
{
"field": "A",
"items": [
{
"Id": 002,
"ItemDescription": "item 2"
},
{
"Id": 003,
"ItemDescription": "item 3"
},
{
"Id": 004,
"ItemDescription": "item 4"
}
]
}
]
I am trying to fetch only the inner object array from the object array.
I have tried different ways to fetch the inner object array from object array,
data.map((u,i) => u[i].map((a,b)=> a.items))
expected result:
data = [
{
"Id": 001,
"ItemDescription": "item 1"
},
{
"Id": 002,
"ItemDescription": "item 2"
},
{
"Id": 003,
"ItemDescription": "item 3"
},
{
"Id": 004,
"ItemDescription": "item 4"
}
]