var jsontext = '{"firstname":"Jesper","surname":"Aaberg","phone":["555-0100","555-0120"]}';  
    var contact = JSON.parse(jsontext);  
    document.write(contact.surname + ", " + contact.firstname + ", "+ contact.phone);  

JSON.parse是用来把JSON字符串转换成对象的

posted on 2014-08-07 16:32  上帝的宠儿  阅读(340)  评论(0编辑  收藏  举报