fixed logic bug in the xpath finder
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 10 Oct 2005 23:04:39 +0000 (23:04 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 10 Oct 2005 23:04:39 +0000 (23:04 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@549 9efc2488-bf62-4759-914b-345cdb29e865

src/objson/object.c

index ee3dbff..f427936 100644 (file)
@@ -702,7 +702,17 @@ jsonObject* _jsonObjectFindPathRecurse(const jsonObject* obj, char* root, char*
                for( i = 0; i < arr->size; i++ ) {
                        jsonObject* a = jsonObjectGetIndex(arr, i);
                        jsonObject* thing = jsonObjectFindPath(a , path + strlen(root) + 1); 
-                       if(thing) jsonObjectPush(newarr, thing);
+
+                       if(thing) { //jsonObjectPush(newarr, thing);
+               if(thing->type == JSON_ARRAY) {
+               int i;
+                                       for( i = 0; i != thing->size; i++ )
+                                               jsonObjectPush(newarr, jsonObjectGetIndex(thing,i));
+
+                               } else {
+                                       jsonObjectPush(newarr, thing);
+                               }                                               
+                       }
                }
        }