mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-05-05 16:33:44 +03:00
parent
bb22ab8ee7
commit
9bffd35432
|
@ -51,6 +51,9 @@ class JSONEncoder(json.JSONEncoder):
|
||||||
return six.text_type(obj)
|
return six.text_type(obj)
|
||||||
elif isinstance(obj, QuerySet):
|
elif isinstance(obj, QuerySet):
|
||||||
return tuple(obj)
|
return tuple(obj)
|
||||||
|
elif isinstance(obj, six.binary_type):
|
||||||
|
# Best-effort for binary blobs. See #4187.
|
||||||
|
return obj.decode('utf-8')
|
||||||
elif hasattr(obj, 'tolist'):
|
elif hasattr(obj, 'tolist'):
|
||||||
# Numpy arrays and array scalars.
|
# Numpy arrays and array scalars.
|
||||||
return obj.tolist()
|
return obj.tolist()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user