New in version 1.1.1.
Tools for using Python’s json module with BSON documents.
This module provides two helper methods dumps and loads that wrap the native json methods and provide explicit BSON conversion to and from json. This allows for specialized encoding and decoding of BSON documents into Mongo Extended JSON‘s Strict mode. This lets you encode / decode BSON documents to JSON even when they use special BSON types.
Example usage (serialization):
.. doctest::
>>> from bson import Binary, Code
>>> from bson.json_util import dumps
>>> dumps([{'foo': [1, 2]},
... {'bar': {'hello': 'world'}},
... {'code': Code("function x() { return 1; }")},
... {'bin': Binary("