def default(self, obj):
    if isinstance(obj, datetime.datetime):
        return int(mktime(obj.timetuple()))
Why does json serialization of datetime objects in python not work out of the box for datetime objects