From 4060000f2f92dc5468c68cc8da0cfbecd3b0349b Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 6 May 2005 01:42:09 +0000 Subject: [PATCH] more fixin git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@302 9efc2488-bf62-4759-914b-345cdb29e865 --- src/javascript/JSON.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/javascript/JSON.js b/src/javascript/JSON.js index c85e789..77e81b4 100644 --- a/src/javascript/JSON.js +++ b/src/javascript/JSON.js @@ -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; } -- 2.11.0