I'm working with two variables:
var parentData: [{
"ID": "869",
"Name": "John"
}, {
"ID": "800",
"Name": "Jane"
}]
var Cost = [{
"Number": "869",
"Amount": 100
}, {
"Number": "800",
"Amount": 200
}, {
"Number": "800",
"Amount": 560
}]
I wish to achieve the following updated result:
{
"parentData": [{
"ID": "869",
"Name": "John",
"Costs": [{
"Number": "869",
"Amount": 100
},
{
"Number": "869",
"Amount": 200
},
{
"NO": "869",
"Amount": 560
}
]
},
{
"ID": "800",
"Name": "Mary",
"Costs": [{
"Number": "800",
"Amount": 100
},
{
"Number": "800",
"Amount": 200
},
{
"Number": "800",
"Amount": 560
}
]
}
]
}
Any suggestions on how to accomplish this?