I have an object of arrays, I want to create individual objects from those array values,
"SUMMARY_TABLE": {
"PRODUCT_CODE": [
123,
123,
123,
123,
123
],
"TYPE": [
"CURRENT",
"OPTIMAL",
"MINIMUM",
"MAXIMUM",
"FUTURE"
],
"LOT_SIZE": [
268.0,
268.0,
268.0,
268.0,
500.0
]}
above is the response Im getting. I want to create 5 individual objects from this data like
{
"product_code": 123,
"type": "current",
"lot_size" : 268
}
similarly using values in the arrays at other indexes. I am trying this but it is not giving me the result I need. k contains the key name and array of values, like ['Product_Code', Arr(5)]
const data = Object.entries(selectedProductDetails.SUMMARY_TABLE).map(
(k, v) => {
let obj = {};
return {
...obj, k: k[i++]
}
});
I would appreciate any help in this.