Posted in Javascript onSeptember 18, 2013
json转成string[需要引用json2.js文件]:
var arr=[{id:'id',name:'Spring'},{id:'id2',name:'Jane'}]; var str=JSON.stringify(arr);
结果:"[{id:'id',name:'Spring'},{id:'id2',name:'Jane'}]"
string转化为json:
var str="[{id:'id',name:'Spring'},{id:'id2',name:'Jane'}]"; var json=$.parseJSON(str);
结果:[{id:'id',name:'Spring'},{id:'id2',name:'Jane'}]
json数据与字符串的相互转化示例
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@