How to combine multiple objects into an array object

{
"date":{"0":"20180201","1":"20180202","2":"20180205"},
"lines":{"0":3.3,"1":10.4,"2":79.721},
"count":{"0":5,"1":21,"2":13},
"counts":{"0":5,"1":26,"2":39},
"limit":{"0":3.3,"1":13.7,"2":93.421}
}

// 
let values = [{date: "20180201", lines: 3.3,count: 5,countS: 5,limit: 3.3},{date: "20180202", lines: 10.4,count: 21,countS: 26,limit: 13.7}...];
Feb.28,2021

let arr = []
for(let key in obj) {
    arr.push(obj[key])
}
console.log(arr)

source is your original object

for(var i =0,len=3;i<len;iPP){
    values[i].date=source['date'][i];
    values[i].lines=source['lines'][i];
    ...
}

const oData = {
"date":{"0":"20180201","1":"20180202","2":"20180205"},
"lines":{"0":3.3,"1":10.4,"2":79.721},
"count":{"0":5,"1":21,"2":13},
"counts":{"0":5,"1":26,"2":39},
"limit":{"0":3.3,"1":13.7,"2":93.421}
},
fnData = function(o, l, a = [], i = 0) {
 for (let k in oData) {
   if (!a[i]) a[i] = {};
   a[i][k] = o[k][i];
 }
 return PPi < l && fnData(o, l, a, i) || a;
};
alert(JSON.stringify(fnData(oData, 3)));

const obj = {
  "date": {"0": "20180201", "1": "20180202", "2": "20180205"},
  "lines": {"0": 3.3, "1": 10.4, "2": 79.721},
  "count": {"0": 5, "1": 21, "2": 13},
  "counts": {"0": 5, "1": 26, "2": 39},
  "limit": {"0": 3.3, "1": 13.7, "2": 93.421}
};
const keys = Object.keys(obj);
const lens = Object.keys(obj[keys[0]]);
let arrays = []
for (const len of lens) {
  let o = {};
  for (const key of keys) {
    o[key] = obj[key][len];
  }
  arrays.push(o);
}
console.log(arrays);

result:

{ '': 
   [ { v_date: '20180201', amt: 3.3, num: 5, sum_num: 5, sum_amt: 3.3 },
     { v_date: '20180202',
       amt: 10.4,
       num: 21,
       sum_num: 26,
       sum_amt: 13.7 },
     { v_date: '20180208',
       amt: 12.1,
       num: 32,
       sum_num: 58,
       sum_amt: 25.8 } ],
  '': 
   [ { v_date: '20180205',
       amt: 79.721,
       num: 13,
       sum_num: 13,
       sum_amt: 79.721 },
     { v_date: '20180206',
       amt: 68.363,
       num: 21,
       sum_num: 34,
       sum_amt: 148.084 },
     { v_date: '20180207',
       amt: 25.674,
       num: 18,
       sum_num: 52,
       sum_amt: 173.758 } ] }

when you execute console.log (Object.values (types)) ), you will find more surprises

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e86b80-dfa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e86b80-dfa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?