浏览器的原生JSON支持(window.JSON) [英] Browser-native JSON support (window.JSON)

查看:724
本文介绍了浏览器的原生JSON支持(window.JSON)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了一些浏览器的原生支持对象的JSON解析/序列化安全,有效地通过 window.JSON 对象引用,但具体细节是很难得的。任何人都可以在正确的方向?什么是这个对象公开的方法呢?什么是浏览器,它支持下?

I have seen references to some browsers natively supporting JSON parsing/serialization of objects safely and efficiently via the window.JSON Object, but details are hard to come by. Can anyone point in the right direction? What are the methods this Object exposes? What browsers is it supported under?

推荐答案

所有现代浏览器都支持本地JSON编码/解码器(Internet Explorer 8+,火狐3.1 +,Safari浏览器4+和Chrome 3+)。基本上, JSON.parse(STR)将解析在 STR JSON字符串,并返回一个对象,而 JSON.stringify(OBJ)将返回对象的JSON重新presentation OBJ

All modern browsers support native JSON encoding/decoding (Internet Explorer 8+, Firefox 3.1+, Safari 4+, and Chrome 3+). Basically, JSON.parse(str) will parse the JSON string in str and return an object, and JSON.stringify(obj) will return the JSON representation of the object obj.

MDN文章的更多细节。

这篇关于浏览器的原生JSON支持(window.JSON)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆