1、往数据里添加json字符串
var arr = []
var json = {"name":"caocao","sex":"男"}
arr.push(json)
console.log(arr)
结果:
[{"name":"caocao","sex":"男"}]
2、往数组的json字符串里新增数据
var j =[{"name":"caocao","sex":"男"}];
j[0].age='18'
console.log(j)
结果:
{name: "caocao", sex: "男", age: "18"}