还需要Json2 / Json3库吗? [英] Json2/Json3 library required still?

查看:228
本文介绍了还需要Json2 / Json3库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问。是否需要再包含 Json2库?我现在读过哪些JavaScript支持JSON作为标准,所以不再需要解析它了吗?

Quick question. Is there any need to include the Json2 library anymore? Did I read somewhere that JavaScript supports JSON as standard these days so there's no need to parse it anymore?

Json2与标准JavaScript支持相比有什么优点或缺点?

Any advantages or disadvantages to Json2 vs standard JavaScript support?

推荐答案

JSON ECMAScript 5 ,符合该规范的浏览器包括 JSON ,但其他浏览器不应该t(例如在 ECMAScript 5 / IE之前发布的那些)。如果您需要支持这些浏览器,您仍然需要包含它。

JSON was standardised in ECMAScript 5, so browsers that conform to that specification include JSON, but others browsers don't (such as those that were released before ECMAScript 5/ IE). If you need to support these browsers, you still need to include it.

具体来说, JSON 引入了:


  • IE8,

  • FireFox 3.5 -

  • Opera 10.5。

  • Chrome(1)(AFAIK)

  • IE8,
  • FireFox 3.5 -
  • Opera 10.5.
  • Chrome (1) (AFAIK)

json2.js 检查是否 JSON.parse 已经实现,只有在没有实现时才提供它的实现;所以把它想象成旧浏览器的一种polyfiller。

json2.js checks whether JSON.parse is already implemented, and only provides it's implementation if it doesn't; so think of it as a sort of polyfiller for older browsers.

来源: http://kangax.github.com/es5-compat-table/ http://caniuse.com/#feat=json

这篇关于还需要Json2 / Json3库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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