My data includes a json file with a product list that looks like this:
[{"id":76,
"name":"A",
"description":"abc",
"price":199,
"imageUrl":"image.jpg",
"productCategory":[{
"categoryId":5,
"category":null
},{
"categoryId":6,
"category":null
}
]}
In addition, I have another json file containing categories as follows:
[{"id":5,"name":"red"},
{"id":6,"name”:"blue"}]
I'm seeking the optimal approach to merge the category information from these two json files using Angular. Our end goal is to achieve the following result:
[{"id":76,
"name":"A",
"description":"abc",
"price":199,
"imageUrl":"image.jpg",
"productCategory":[{
"categoryId":5,
"category":red
},{
"categoryId":6,
"category":blue
}
]}