diff --git a/rest_framework/parsers.py b/rest_framework/parsers.py index 238382364..0e40e1a7a 100644 --- a/rest_framework/parsers.py +++ b/rest_framework/parsers.py @@ -6,6 +6,7 @@ on the request, such as form content or json encoded data. """ from __future__ import unicode_literals +import codecs import json from django.conf import settings @@ -61,8 +62,8 @@ class JSONParser(BaseParser): encoding = parser_context.get('encoding', settings.DEFAULT_CHARSET) try: - data = stream.read().decode(encoding) - return json.loads(data) + decoded_stream = codecs.getreader(encoding)(stream) + return json.load(decoded_stream) except ValueError as exc: raise ParseError('JSON parse error - %s' % six.text_type(exc))