I hope the title is accurate but what I have is an array 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"
}
]
}
]
}
And I would like to merge all "array" properties together in a new array possibly, to something that looks like 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 a good way to combine all these properties in Typescript? I'm looking for a Typescript/Angular friendly solution since this will be looped over to create elements in HTML.