Is there a way to combine 4 separate arrays of objects into one big object based on the keys inside an object?
For example: OUTPUT: What I want to achieve.
[
{
"bugId": "",
"testerId": "",
"firstName": "",
"lastName": "",
"country": "",
"deviceId":"",
"description":""
}
]
An array of testers
(over 500 entries)
[
{
"testerId":"1",
"firstName":"John",
"lastName":"Doe",
"country":"US",
}
]
An array for bugId
(the main object for getting the output)
Since deviceId
is linked to description
and testerId
is linked to firstName
, lastName
and Country
.
[
{
"bugId":"1",
"deviceId":"1",
"testerId":"1"
}
]
An array for tester_devices
, where each tester has 4 devices
[
{
"testerId":"1",
"deviceId":"1"
},
{
"testerId":"1",
"deviceId":"2"
},
{
"testerId":"1",
"deviceId":"3"
},
{
"testerId":"1",
"deviceId":"10"
}
]
An array of devices
[
{
"deviceId":"1",
"description":"iPhone 4"
}
]
I looked into the Lodash Library, but found that merging objects with the same key names may be problematic. What approach should I consider?