Closed dzimbeck closed 2 years ago
Thanks @dzimbeck this is indeed surprising. I suspect this is a bug in libbson that might be fixed in the latest release. This project uses libbson 1.6.2 and the current release is 1.11.0, http://mongoc.org/libbson/current/index.html.
Once we update for Extend JSON v2.0 support in #11 I'll come back to this issue.
@juliusgeo this should be resolved by updating to the latest version of libbson.
This issue does not seem to be solved by the latest version of libbson (1.20.0).
Python 3.8.9 (default, Aug 21 2021, 15:53:23)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bsonjs
>>> import json
>>> import bson
>>> bson.decode(bsonjs.loads(json.dumps([])))
{}
This is after running pip install -e .
on the master branch of python-bsonjs
PR (#37 ) resolved this issue by documenting the behavior and illustrating a workaround for it in the README.
if you do the following: bsonjs.loads(json.dumps([]))
The result is {}
This caused some minor issues in a program I'm working on. Since json is able to load lists I think there is no reason bson shouldn't experience similar behavior.