json.JSONEncoder.default = lambda self, obj: obj.isoformat() if isinstance(obj,
    datetime.datetime) else None
Why does json serialization of datetime objects in python not work out of the box for datetime objects