gotta protect the JSONObject2Perl() when decoding arrays as well
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 17 Feb 2009 18:04:39 +0000 (18:04 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 17 Feb 2009 18:04:39 +0000 (18:04 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1666 9efc2488-bf62-4759-914b-345cdb29e865

src/perl/lib/OpenSRF/Utils/JSON.pm

index 7b962e1..c37fa1f 100644 (file)
@@ -80,11 +80,14 @@ sub JSONObject2Perl {
                        return undef;
                }
         for my $k (keys %$obj) {
-            $obj->{$k} = (ref($obj->{$k}) eq 'JSON::XS::Boolean') ? 
-                $obj->{$k} : $class->JSONObject2Perl($obj->{$k});
+            $obj->{$k} = $class->JSONObject2Perl($obj->{$k}) 
+                unless ref($obj->{$k}) eq 'JSON::XS::Boolean';
         }
        } elsif( $ref eq 'ARRAY' ) {
-               $obj->[$_] = $class->JSONObject2Perl($obj->[$_]) for(0..scalar(@$obj) - 1);
+               for my $i (0..scalar(@$obj) - 1) {
+                   $obj->[$i] = $class->JSONObject2Perl($obj->[$i]) 
+                unless ref($obj->[$i]) eq 'JSON::XS::Boolean';
+        }
        }
        return $obj;
 }