I have to implement new data in the form of a table into a legacy system. I just can't figure out how to merge the object values with the key and merge them into an array key
{
"amount": [
"33300.00",
"43075.00",
"93300.00",
"193300.00",
],
"rent_label": [
"Due",
"Due",
"Due",
"Due",
],
"date": [
"2020-04-02T00:00:00.000Z",
"2020-03-03T00:00:00.000Z",
"2020-02-04T00:00:00.000Z",
"2020-01-15T00:00:00.000Z",
]
}
What I already tried
let data = Object.keys(obj).map((key) => {
let keyVal = Object.values(obj[key]).map((val) {
return { [key]: val}
})
return data;
});
What I rather need is the array to be like this
[
{
"amount": "33300.00",
"rent_label": "Due",
"date": "2020-04-02T00:00:00.000Z"
},
{
"amount": "33300.00",
"rent_label": "Due",
"date": "2020-04-02T00:00:00.000Z"
},
{
"amount": "33300.00",
"rent_label": "Due",
"date": "2020-04-02T00:00:00.000Z"
},
]
