Let's say we are working with two different datasets:
student$ = from([
{id: 1, name: "Alex"},
{id: 2, name: "Marry"},
])
address$ = from([
{id: 1, location: "Chicago", sid: 1},
{id: 2, location: "Florida", sid: 2},
])
The task at hand is to merge these two datasets into an array of objects. The desired output should resemble the following structure:
studentAddress = [
{
id: 1,
name: "Alex",
address: [
{id: 1, location: "Chicago", sid: 1},
]
},
{
id: 2,
name: "Marry",
address: [
{id: 2, location: "Florida", sid: 2},
]
},
]