def dump_json(self, d):
"""
Encodes the object *d* as JSON string.
This method *can be overridden* if you want to use your own json
serializer.
The default implementation uses the :mod:`json` module of the standard
library and (if available) the :mod:`bson` json utils.
:arg d:
:rtype: str
"""
indent = 1 if self.debug else None
if bson:
return json.dumps(d, default=bson.json_util.default, indent=indent)
else:
return json.dumps(d, indent=indent)
评论列表
文章目录