javascriptはjsonの添削を調べます.
1216 ワード
<script type="text/javascript">
var json = {
"age":24,
"name":"cst"
};
// Json age , Json age
json["age"] = 30;
alert(json.age); //30
// Json sex , Json sex
json["sex"] = "M";
alert(json.sex); //M
<!-- Json -->
for(var key in json){
try{
var value = eval("json['" + key +"']");
alert(key+"_"+value);
}catch(e){}
}
// Json age
delete json["age"];
alert(json.age); //undefined
</script>
http://blog.csdn.net/shangliuyan/article/details/8072257