Looking for help with merging two different object arrays:
array1 = [Object, Object, Object]
array2 = [Object, Object, Object]
Each Object in array1 has the structure:
{property1 : "somevalue"}
While each Object in array2 follows this structure:
{property1 : Object, property2 : "somevalue"}
The goal is to combine these arrays into a single array resembling JSON format. The desired final structure looks like this:
{
"root1" : array1, "root2" : array2
}
An example of the final JSON output would be:
{
"root1" : [
{property1 : "somevalue"},
{property1 : "somevalue"},
{property1 : "somevalue"}
],
"root2" : [
{property1 : Object, property2 : "somevalue"},
{property1 : Object, property2 : "somevalue"},
{property1 : Object, property2 : "somevalue"}
]
}
Any suggestions on how to achieve this during runtime?