`{age:23,name:“你”}` 在已有的json里,加一对?有哪些方法?
1 回答
不负相思意
TA贡献1777条经验 获得超10个赞
> var str = '{"age":23,"name":"你"}'
> var object = JSON.parse(str)
> object.newKey = 'newvalue'
'newvalue'
> object
{ age: 23, name: '你', newKey: 'newvalue' }
> JSON.stringify(object)
'{"age":23,"name":"你","newKey":"newvalue"}'
添加回答
举报
0/150
提交
取消