added support for hash-encoded json objects
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 6 Mar 2008 17:28:04 +0000 (17:28 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 6 Mar 2008 17:28:04 +0000 (17:28 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1258 9efc2488-bf62-4759-914b-345cdb29e865

src/javascript/JSON_v1.js

index cfc0a36..7be5639 100644 (file)
@@ -46,11 +46,19 @@ function decodeJS(arg) {
                eval('arg = new ' + arg[JSON_CLASS_KEY] + '(arg[JSON_DATA_KEY])');      
        }
 
-       jsIterate( arg, 
-               function(o, i) {
-                       o[i] = decodeJS(o[i]);
-               }
-       );
+    if(arg._encodehash) {
+           jsIterate( arg.hash, 
+                   function(o, i) {
+                           o[i] = decodeJS(o[i]);
+                   }
+           );
+    } else {
+           jsIterate( arg, 
+                   function(o, i) {
+                           o[i] = decodeJS(o[i]);
+                   }
+           );
+    }
 
        return arg;
 }