let nape = []; for (let i = 0; i < list.length; i++) { let res = JSON.parse( JSON.stringify(list[i]) .replace(/id/g, 'itemId') .replace(/desc/g, 'itemName') ); nape.push(res); } console.log(nape)
修改前
修改后
let nape = []; for (let i = 0; i < list.length; i++) { let res = JSON.parse( JSON.stringify(list[i]) .replace(/id/g, 'itemId') .replace(/desc/g, 'itemName') ); nape.push(res); } console.log(nape)
修改前
修改后