def json_ser(obj):
 if isinstance(obj, (datetime, date)):
  return obj.isoformat()

def json_ser ( obj ) : if isinstance ( obj , ( datetime , date ) ) : return obj . isoformat ( )
json serializer that deals with dates usage: json .