var result={
    "a":{
        "x":5,
        "y":0,
        "z":0
    },
    "b":{
        "x":0,
        "y":0,
        "z":3
    },
    "c":{
        "x":5,
        "y":0,
        "z":0
    },
    "d":{
        "x":0,
        "y":0,
        "z":4
    },
    "e":{
        "x":0,
        "y":3,
        "z":0
    }
};
var arr=[];
var obj={
    keyArr:['dec'],
    one:['x'],
    two:['y'],
    three:['z']
};
for(var key in result){
    obj.keyArr.push(key);
    var thisResult=result[key];
    obj.one.push(thisResult.x);
    obj.two.push(thisResult.y);
    obj.three.push(thisResult.z);
}
//obj.one.unshift("x");
//obj.two.unshift("y");
//obj.three.unshift("z");
for(var i in obj){
    arr.push(obj[i]);
}
console.log(arr);

如何把返回的对象以及对应的数据保存到二维数组

 

相关文章:

  • 2022-02-26
  • 2022-02-26
  • 2021-09-19
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2021-06-06
  • 2021-04-06
猜你喜欢
  • 2021-12-10
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2021-04-29
  • 2021-10-05
相关资源
相似解决方案