parse 从字符串解析出json对象:
var data = ‘{"a":1,"b":2}‘;
JSON.parse(data);
返回Object
a:1
b:2
_proto_:Object
stringify从json对象解析出字符串:
var data = {a:1,b:2}
JSON.stringify(data)
返回:
‘{"a":"1","b":"2"}‘
JSON.parse()和JSON.stringify() 用法,布布扣,bubuko.com
时间: 2024-10-07 05:02:11