py-bson / bson

Independent BSON codec for Python that doesn't depend on MongoDB.
Other
443 stars 82 forks source link

numeric keys are not serialized properly #90

Closed mirage007 closed 6 years ago

mirage007 commented 6 years ago

Given that bson can serialize floats, i was expecting float keys as valid, but it seems they are converted to strings on serialization, is that expected behavior or a bug?

>>> from bson import loads, dumps
>>> loads(dumps({1.2: 3}))
{'1.2': 3}
Parkayun commented 6 years ago

Key in bson should be string. Thanks.