-
-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: JSON.stringify(), JSON.parse() #258
Comments
👎 Why do we need another polyfill if we can use either JSON2 or JSON3? |
This should stay open, as it's a genuine question. Anything that's in the ES5 spec that can be made to work in ES3 should be strongly considered for the shim. |
Assuming they both implement the |
Maybe adding a note in the README suggesting |
I would like to see these in es5-shim, json2 is not standards compliant (I have tests available) and it makes no effort to check the environment other than for truthy/falsy existence. json3 goes a step further and does perform checking and tries to be standards compliant, so this would be the one I'd go for. So, I guess the main reason is that it would be nice to have all the es5-shims in one rather than load multiple files, just a preference. :) |
One file vs multiple files is a build pipeline concern - you should be using browserify/webpack anyways in 2015. If there doesn't exist an ES5-compliant JSON shim, then that's a great reason to build one and link to it from here, but it'd likely be too large to include in |
I'm fine with that. |
Been taking a closer look at JSON3, and there is some really good work over there, however there are things that I'm not so enthralled by and I see a fair amount of repetition of what has been achieved here in es5-shim (though I'm not convinced that it is to the same standard of breadth and accuracy). While I would still use it over JSON2, my feeling is that I would like to see it integrated here, it all feels correct to be here. I'd estimate about 500 lines of code (JSON3 is 900, with all the repeated work, line spaces and all the comments), and then the tests. Maybe they could be convinced to submit their work to es5-shim, or I'd be willing to work with you to port it over (or even JSON2). I believe I have most, if not all, of the tests already in the format for this project (those I could submit to you fairly quickly). |
es-shims#258 Ported the latest JSON3 test suite.
es-shims#258 Ported the latest JSON3 test suite.
es-shims#258 Ported the latest JSON3 test suite. Jasminize.
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
es-shims#258 Add spec to html
ECMAScript 5 added
JSON.stringify()
andJSON.parse()
, which ECMAScript 3- did not have built-in.As a workaround, we can use these example functions in
json2.js
. (The old homepage for json2 is dead, but the script still lives in content distribution networks.)http://cdnjs.com/libraries/json2
The text was updated successfully, but these errors were encountered: