Skip to content

Commit

Permalink
JSON was overwriting the native JSON.parse and stringify. We wanted t…
Browse files Browse the repository at this point in the history
…o keep those native methods while also keeping JSON as a Hash for compatibility reasons. Since the native methods are marked DontEnum, this is the cleanest way I could think of doing it. Fixes #741 and #607.
  • Loading branch information
appden committed Sep 10, 2009
1 parent 5a24e2f commit e2d71f2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Source/Utilities/JSON.js
Expand Up @@ -9,8 +9,11 @@ See Also:
<http://www.json.org/>
*/

var JSON = new Hash({

var JSON = new Hash(this.JSON && {
stringify: JSON.stringify,
parse: JSON.parse
}).extend({

$specialChars: {'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'},

$replaceChars: function(chr){
Expand Down

0 comments on commit e2d71f2

Please sign in to comment.