more fixin
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 6 May 2005 01:42:09 +0000 (01:42 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Fri, 6 May 2005 01:42:09 +0000 (01:42 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@302 9efc2488-bf62-4759-914b-345cdb29e865

src/javascript/JSON.js

index c85e789..77e81b4 100644 (file)
@@ -31,6 +31,14 @@ function JSON2js (json) {
 }
 
 
+function object2Array(obj) {
+       var arr = new Array();
+       for( var i  = 0; i < obj.length; i++ ) {
+               arr[i] = obj[i];
+       }
+       return arr;
+}
+
 function js2JSON(arg) {
        var i, o, u, v;
 
@@ -44,7 +52,13 @@ function js2JSON(arg) {
                                        var arr = new Array();
                                        if( arg.array.constructor != Array ) {
                                                for( var i  = 0; i < arg.array.length; i++ ) {
-                                                       arr[i] = arg.array[i];
+                                                       if(arg.array[i]._isfieldmapper) {
+                                                               arr[i] = arg.array[i];
+                                                       } else if( typeof arg.array[i] != 'object' ) { 
+                                                               arr[i] = arg.array[i];
+                                                       } else {
+                                                               arr[i] = object2Array(arg.array[i]);            
+                                                       }
                                                }
                                                arg.array = arr;
                                        }