Details
-
Bug
-
Resolution: Done
-
Minor - P4
-
1.5.0
-
None
Description
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.
Attachments
Issue Links
- 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
-