Retrieve data from a REST API in the following format:
{
"ProductID":1,
"Category":[
{
"CategoryID":1,
"SubCategory":[
{
"SubCategoryID":1,
}
]
}
]
}
I need to transform this output data using TypeScript into:
[
{
"ProductID":1,
"Category":{
"CategoryID":1,
"SubCategory":{
"SubCategoryID":1,
`enter code here`
}
}
}
]
My attempted solution is as follows:
return this.restApi.getProductBin().subscribe((data: {}) => {
const usersJson: any[] = Array.of(data);
})