tosimplestring now returns int/double as expected
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 10 Nov 2005 19:03:17 +0000 (19:03 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 10 Nov 2005 19:03:17 +0000 (19:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1998 dcc99617-32d9-48b4-a31d-7c20da2025e4

OpenSRF/src/objson/object.c

index f427936..e70836b 100644 (file)
@@ -760,8 +760,16 @@ char* jsonObjectToSimpleString( const jsonObject* o ) {
                switch( o->type ) {
 
                        case JSON_NUMBER: {
-                               DOUBLE_TO_STRING(o->value.n);
-                               value = strdup(DOUBLESTR);
+
+                               if( o->value.n == (int) o->value.n ) {
+                                       INT_TO_STRING((int) o->value.n);        
+                                       value = strdup(INTSTR);
+       
+                               } else {
+                                       DOUBLE_TO_STRING(o->value.n);
+                                       value = strdup(DOUBLESTR);
+                               }
+
                                break;
                        }