1, JSON对象使用举例
function showJSON()
{
var user =
{
//相当于java对象类中的 "普通"(java基本数据类型和String类型)属性
"userName": "andy",
"age": 20,
//相当于java对象类中的"对象"属性
"info": {
"tel":123456,
"cellphone":45632178
},
//相当于java对象类中的"集合"(Collection)属性
"address": [
{
"city":"beijing", "postcode":"222231"
},
{
"city": "newYork", "postcode":"7896245"
}
]
}
alert(user.userName);
user.userName = "刘利锋";
alert(user.userName);
}