JSON2.3使用

< script type = "text/javascript" src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js" ></ script >
< script type = "text/javascript" src = "http://jquery-json.googlecode.com/files/jquery.json-2.3.min.js" ></ script >
< script type = "text/javascript" >
var goods = {
    id: '001',
    name: 'DEMO'
}
var str = $.toJSON(goods);
alert(str); //{"id":"001","name":"DEMO"}
alert($.evalJSON(str).name); //DEMO
</ script >

你可能感兴趣的:(json)