日期:2014-05-16 浏览次数:20415 次
JSON对象就像是PHP或Java中map型(数组)
?
1、JSON对象的构造方法:
var json_obj ={};
?
2、循环为JSON对象赋值:
var array_obj = ["A","B","C","D","E","F","G","H"]; for (i=0; i<array_obj.length; i++) { json_obj[i]=array_obj[i]; }
?3、判断JSON对象是否具有某属性:
if (json_obj["key"]) { .... }?
4、利用javascript的delete关键字来删除JSON对象的属性:
delete json_obj["key"];?