javascript操作json方法
/*新增json的对象属性*/ var json = {}; json["subjectName"] = "ddd"; json.teacherlist = "A教师,B教师,C教师,D教师"; /*删除json的对象属性*/ var p = { "name" : "chaomao", "age" : 45, "sex" : "male" }; delete p.name for(var i in p){ alert(i) console.log(i);//输出age,sex,name项已经被删除了 }
wala-wo