-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.5.0
-
Component/s: libbson
-
None
Example code:
#include <bson.h> #include <stdio.h> int main() { bson_t b = BSON_INITIALIZER; BSON_APPEND_DOUBLE (&b, "a", 1.0); size_t len; char *str; str = bson_as_json (&b, &len); printf ("%s\n", str); bson_free (str); return 0; }
Actual output:
{ "a" : 1 }
Possibly expected output:
{ "a" : 1.0 }
Some JSON encoders will preserve a fractional part of zero. This behavior surprised as least one user as shown on this stack overflow post.
- causes
-
CDRIVER-4819 Allow reducing precision when converting BSON double values to JSON
- Backlog
- related to
-
CDRIVER-3377 Double value retrieved from bson is different than expected
- Closed