json对象转二维数组

//json对象,json_encode($excel_lists)
[
 {
  "ord_cd": "Order Number",
  "usr_id": "user ID",
  },
 {
 "ord_cd": "12",
 "usr_id": "delia1",
 }
]
//带key值的json对象转化为二维数组
var arrData = json.excel_lists;
var data= [];
for (var i in arrData) {
    var item = [];
    for (var j in arrData[i]) item.push(arrData[i][j]);
    data.push(item)
}
//二维数组
[
 ["Order Number", "user ID"], 
 ["12", "delia1"]
] 

你可能感兴趣的:(javascript)