JSON2 vs. jquery-json

前端 未结 3 686
你的背包
你的背包 2020-12-19 03:15

This is probably a simple question, which I can\'t seem to find a solid answer to.

Why would one choose JSON2 over jquery-json plugin (http://code.google.com/p/jquer

3条回答
  •  [愿得一人]
    2020-12-19 03:38

    An important difference between the two is that JSON2's api is exactly the same as the native api whereas jquery-json is a jquery plugin (which is slightly different than falling back on the native implementation).

    I would say your answer depends on which api you want to use since you'll get the same results with either implementation (you should at least).

    As a thought experiment, let's imagine that every browser had a native JSON api implementation. Would you still use jquery-json?

    If so, then use the jquery plug-in.

    If not, then why would you tie your code to the jquery-json api when the native api is already well-known (even if its not globally implemented)?

    If it means anything to you, John Resig (the creator of jQuery) has said "In the meantime PLEASE start migrating your JSON-using applications over to Crockford's json2.js"

提交回复
热议问题