3

Encountered this article today:

Serializing to JSON in jQuery

It discusses how to parse and serialize JSON, and references this article by John Resig written in May of 2009, as a reference for using json2.js. While the information in the article is (arguably) partially relevant, it's extremely dated.

I'd like to propose the following edits to it. Are these suitable edits for SO, and is this sufficient justification to edit the current answer?

  1. Reposition the details about native implementation to the top of the answer, moving the link to json2.js below
  2. Remove the quote and reference to John Resig's article.

E.g.:


For modern browsers:

To convert an object to a JSON string, use JSON.stringify:

var json_text = JSON.stringify(your_object, null, 2);

To convert a string to JSON object, use JSON.parse:

var your_object = JSON.parse(json_text);

For legacy browsers:

While Newer browsers support the JSON object natively, older ones do not. One workaround is to use json2.js, which gracefully falls back eval() on older browsers, while another is to implement jQuery.parseJSON.

4
  • I would only leave a comment because that answer is so heavily upvoted and add a new answer, if that is still valid for the question, to cover the preferred implementation in the current timeframe.
    – rene Mod
    Commented Dec 8, 2013 at 13:34
  • 1
    With outdated answers always remember people on legacy systems. Add new information but don't remove the old Commented Dec 8, 2013 at 14:45
  • I think my biggest concern was the quote and link back to the old article (which in turn actually includes dead links). It has no bearing anymore on the relevance of the answer, no? Commented Dec 8, 2013 at 19:54
  • Made a minor adjustment to my proposal to show the difference between modern/legacy usage. Commented Dec 9, 2013 at 21:35

0

You must log in to answer this question.

Browse other questions tagged .