Looking to extract a specific array from a JSON response based on mismatched dataIDs and parentDataIDs using TypeScript in Angular 7.
{ "data":[
{
"dataId":"Atlanta",
"parentDataId":"America"
},
{
"dataId":"Newyork",
"parentDataId":"America"
},
{
"dataId":"Georgia",
"parentDataId":"Atlanta"
},
{
"dataId":"South",
"parentDataId":"Atlanta"
},
{
"dataId":"North",
"parentDataId":"South"
}
]
}
In the above response, the dataID Newyork does not match any of the parentDataIDs in the entire JSON array. I now aim to filter out only the second array with DataID to create a new array.
This validation will be implemented in TypeScript for Angular 7.
The desired output should look like this - showing DataIDs without corresponding parentDataIDs:
[
{
"dataId":"Newyork",
"parentDataId":"America"
},
{
"dataId":"Georgia",
"parentDataId":"Atlanta"
},
{
"dataId":"North",
"parentDataId":"South"
}
]
Any assistance or feedback is greatly appreciated.