includes/clientside/static/json.js
changeset 873 285f0c6d9c9a
parent 582 a38876c0793c
child 1227 bdac73ed481e
--- a/includes/clientside/static/json.js	Fri Mar 20 09:14:03 2009 -0400
+++ b/includes/clientside/static/json.js	Fri Mar 20 09:15:00 2009 -0400
@@ -11,6 +11,10 @@
 
 function toJSONString(input)
 {
+  if ( window.JSON )
+  {
+    return window.JSON.stringify(input);
+  }
   var m = {
           '\b': '\\b',
           '\t': '\\t',
@@ -142,6 +146,11 @@
 
 function parseJSON(string, filter)
 {
+  if ( window.JSON )
+  {
+    return window.JSON.parse(string);
+  }
+  
   try {
     if (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.
             test(string))