mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
parent
bb22ab8ee7
commit
9bffd35432
|
@ -51,6 +51,9 @@ class JSONEncoder(json.JSONEncoder):
|
|||
return six.text_type(obj)
|
||||
elif isinstance(obj, QuerySet):
|
||||
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'):
|
||||
# Numpy arrays and array scalars.
|
||||
return obj.tolist()
|
||||
|
|
Loading…
Reference in New Issue
Block a user