passing numbers as bare strings
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 28 Jul 2005 21:35:32 +0000 (21:35 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 28 Jul 2005 21:35:32 +0000 (21:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1576 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/perlmods/JSON.pm

index ece6bb0..0b0e16b 100644 (file)
@@ -223,7 +223,11 @@ sub perl2JSON {
                $perl =~ s/\r/\\r/sgo;
                $perl =~ s/\n/\\n/sgo;
                $perl =~ s/(\pM)/sprintf('\u%0.4x',ord($1))/sgoe;
-               $output = '"'.$perl.'"';
+               if ($perl =~ /^(?:\+|-)?\d*\.?\d+$/) {
+                       $output = $perl;
+               } else {
+                       $output = '"'.$perl.'"';
+               }
        }
 
        return $output;