diff --git a/rest_framework/utils/encoders.py b/rest_framework/utils/encoders.py index 949c99eda6..f883b49257 100644 --- a/rest_framework/utils/encoders.py +++ b/rest_framework/utils/encoders.py @@ -51,6 +51,9 @@ def default(self, obj): 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()