diff options
| author | Philip Douglas | 2013-10-03 11:12:55 +0100 |
|---|---|---|
| committer | Philip Douglas | 2013-10-03 11:12:55 +0100 |
| commit | a2ae469f6ba6ed7e69e9c6a7741876ae14a36057 (patch) | |
| tree | 399110e75bc1c3b2fbddd314526c3c17f9d68574 /rest_framework/utils/encoders.py | |
| parent | e5da0ff5e530c8ea0e2cf4dff0723ede6234860e (diff) | |
| parent | c3175900bc0681965d07d85c8b9010534e0ff901 (diff) | |
| download | django-rest-framework-a2ae469f6ba6ed7e69e9c6a7741876ae14a36057.tar.bz2 | |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'rest_framework/utils/encoders.py')
| -rw-r--r-- | rest_framework/utils/encoders.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index b26a2085..7efd5417 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -42,6 +42,8 @@ class JSONEncoder(json.JSONEncoder): return str(o.total_seconds()) elif isinstance(o, decimal.Decimal): return str(o) + elif hasattr(o, 'tolist'): + return o.tolist() elif hasattr(o, '__iter__'): return [i for i in o] return super(JSONEncoder, self).default(o) |
