Fixes #1280 - Resolved issue in json encoding while dealing with the

date format.
This commit is contained in:
Murtuza Zabuawala 2016-06-03 15:48:35 +05:30 committed by Ashesh Vashi
parent fc654a0934
commit 6501f4cf36

View File

@ -18,7 +18,8 @@ import decimal
class DataTypeJSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
if isinstance(obj, datetime.datetime) \
or hasattr(obj, 'isoformat'):
return obj.isoformat()
if isinstance(obj, decimal.Decimal):
return float(obj)