tosimplestring now returns int/double as expected
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 10 Nov 2005 19:03:17 +0000 (19:03 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 10 Nov 2005 19:03:17 +0000 (19:03 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@578 9efc2488-bf62-4759-914b-345cdb29e865

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;
                        }