blob: 2ef4f96593b566fc8119024c41f30dabdf44b4c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import flask
from bson.objectid import ObjectId
class JSONEncoder(flask.json.JSONEncoder):
"""
A customized JSON encoder to handle unsupported types.
"""
def default(self, o):
if isinstance(o, ObjectId):
return str(o)
return flask.json.JSONEncoder.default(self, o)
|