I have a JS array of objects which looks like:
[{
a : {},
b: {},
c: [{}, {}]
}]
Now I want to flatten this object in such a way, that the array now becomes:
[
{
a : {},
b: {},
c: {}
},
{
a : {},
b: {},
c: {}
},
]
Note that the array c was flattened, while all the other fields were duplicated across the two objects. What is the best way to do this?