首页 > 代码库 > JSON.parse这个是啥?

JSON.parse这个是啥?

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字符串转换成对象的