def default(self, obj, **kwargs): if isinstance(obj, ObjectId): return str(obj) else: return JSONDecoder.default(obj, **kwargs)