MongoDB Object Serialized as JSON?

In newer versions of simplejson (and the json module in Python 2.7) you implement the default method in your subclasses.

In newer versions of simplejson (and the json module in Python 2.7) you implement the default method in your subclasses: from json import JSONEncoder from pymongo. Objectid import ObjectId class MongoEncoder(JSONEncoder): def default(self, obj, **kwargs): if isinstance(obj, ObjectId): return str(obj) else: return JSONEncoder. Default(obj, **kwargs) You could then use the encoder with MongoEncoder().

Encode(obj) or json. Dumps(obj, cls=MongoEncoder).

Perfect! Thanks. – Donnie Jun 6 at 18:01.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions