I have an array of arrays with the following structure:
[
[ {"key": someKey, value: "someValue"},
{key: someOtherKey, value: "someOtherValue} ],
[ {"key": someKey, value: "someValue"},
{key: someOtherKey, value: "someOtherValue} ],
]
I want to transform this structure into a list of object with dynamic keys and values like such:
[{someKey: someValue}, {someOtherKey: someOtherValue}]
So far i have this code
const serializedData = data.map(entry =>{
console.log(entry)
return entry.reduce(
(obj, item) => {
return Object.assign(obj, { [item.key]: item.value })
})
})
But this only serializes the keys for the first entry (i have provided image examples below), can anybody help me to create the correct dataformat?