js 全局替换数组中的对象的某个属性,主要代码如下
var jsons = [{name:"张三",age:23,shouru:3000},{name:"李四",age:23,shouru:3000},{name:"王五",age:23,shouru:3000},{name:"星河",age:23,shouru:3000}] var jsona = JSON.stringify(jsons) console.log(jsona,'11') var jsonb = jsona.replace(/"age"/g,'"lag"') var jsonc = JSON.parse(jsonb) console.log(jsonc)