Is json2.js required for Backbone.js?

From the website:

Only a tough baseline dependency is Underscore.js (> 1.4.3) or Lo-Dash. To preserve RESTful history support using Backbone.Router and DOM manipulations with Backbone.View include json2.js and jQuery (> 1.4.2) or Zepto.

Why is json2.js mentioned? I launched my application in ie7-9 among other browsers without requiring this file and it works. Is this a performance thing?

+4
source share
3 answers

json2.js provides the JSON.parse and JSON.stringify functions on which the Trunk depends. They have been included in browsers for a while , but they are probably listed if your environment does not include it, or you want a consistent implementation in your application.

+3
source

That the script adds JSON functions to old browsers, which will look just like the built-in functions existing in new browsers

https://github.com/douglascrockford/JSON-js

+2
source

Like other answers, you only need to download and enable the “manual” JSON library if you need to support older browsers; otherwise your browser will be embedded in it (as you saw Backbone working without problems).

For an exact list in which browsers have / do not have built-in JSON, see http://caniuse.com/#feat=json

+1
source

All Articles