轉自:http://blog.csdn.net/wangxiaohu__/article/details/7254598 json
parse用於從一個字符串中解析出json對象,如ide
var str = '{"name":"huangxiaojian","age":"23"}'
spa
結果:.net
JSON.parse(str)
code
Objectorm
age: "23"對象
name: "huangxiaojian"blog
__proto__: Objectci
注意:單引號寫在{}外,每一個屬性名都必須用雙引號,不然會拋出異常。字符串
stringify()用於從一個對象解析出字符串,如
var a = {a:1,b:2}
結果:
JSON.stringify(a)
"{"a":1,"b":2}"