Is the title accurate for my task? I have an array structured like this:
{
"someValue": 1,
"moreValue": 1,
"parentArray": [
{
"id": "2222",
"array": [
{
"type": "test",
"id": "ID-100"
},
{
"type": "test1",
"id": "ID-200"
}
]
},
{
"id": "5555",
"array": [
{
"type": "test",
"id": "ID-100"
},
{
"type": "test1",
"id": "ID-200"
}
]
},
{
"id": "444",
"array": [
{
"type": "test",
"id": "ID-100"
},
{
"type": "test1",
"id": "ID-200"
}
]
}
]
}
I aim to merge all "array" properties into a new array, resulting in a structure similar to this:
{
"someValue": 1,
"moreValue": 1,
"array": [
{
"type": "test",
"id": "ID-100"
},
{
"type": "test1",
"id": "ID-200"
},
{
"type": "test",
"id": "ID-4400"
},
{
"type": "test1",
"id": "ID-500"
},
{
"type": "test",
"id": "ID-600"
},
{
"type": "test1",
"id": "ID-700"
}
]
}
What would be the optimal method to consolidate these properties using Typescript? I'm seeking a Typescript/Angular-friendly solution as this data needs to be utilized to generate HTML elements.