This commit is contained in:
Dave Pretty 2013-09-13 11:41:57 -07:00
commit 8fc0395243

View File

@ -42,6 +42,8 @@ class JSONEncoder(json.JSONEncoder):
return str(o.total_seconds()) return str(o.total_seconds())
elif isinstance(o, decimal.Decimal): elif isinstance(o, decimal.Decimal):
return str(o) return str(o)
elif hasattr(o, 'tolist'):
return o.tolist()
elif hasattr(o, '__iter__'): elif hasattr(o, '__iter__'):
return [i for i in o] return [i for i in o]
return super(JSONEncoder, self).default(o) return super(JSONEncoder, self).default(o)