Forked version of MbedJSONValue. I edited the source to allow only two decimal places for a float/double value

Fork of MbedJSONValue by d 0773d

Files at this revision

API Documentation at this revision

Comitter:
d0773d
Date:
Wed Oct 10 08:40:03 2012 +0000
Parent:
4:10a99cdf7846
Child:
6:0c788cef9bfa
Commit message:
I edited line 91 in MbedJSONValue.cpp from:; ; sprintf(buf, "%f", _value.asDouble);; ; ; to:; sprintf(buf, "%.2f", _value.asDouble);;

Changed in this revision

MbedJSONValue.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MbedJSONValue.cpp	Thu Sep 22 10:57:37 2011 +0000
+++ b/MbedJSONValue.cpp	Wed Oct 10 08:40:03 2012 +0000
@@ -88,7 +88,8 @@
         }
         case TypeDouble:    {
             char buf[10];
-            sprintf(buf, "%f", _value.asDouble);
+            //sprintf(buf, "%f", _value.asDouble);
+            sprintf(buf, "%.2f", _value.asDouble); //limits the trailing zeros at the end of a double value
             return buf;
         }
         default: