var dd = '[{"货号":"A1001","_40码":"10","_41码":"11","_42码":"12"},{"货号":"A1002","_40码":"20","_41码":"21","_42码":"22"}]'
var obj = JSON.parse(dd);
var arr = new Array();
obj.forEach(ele => {
let obj={
货号:Object.keys(ele)[1],
尺码:ele.货号,
数量:ele._40码
}
arr.push(obj)
});
alert(JSON.stringify(arr,null,""))
代码给你看。看着抄吧
|