mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Merge 1123bf1011
into 8f6173cd8a
This commit is contained in:
commit
bd6033ea00
|
@ -51,6 +51,7 @@ class JSONParser(BaseParser):
|
|||
Parses JSON-serialized data.
|
||||
"""
|
||||
media_type = 'application/json'
|
||||
decoder_class = json.JSONDecoder
|
||||
renderer_class = renderers.JSONRenderer
|
||||
|
||||
def parse(self, stream, media_type=None, parser_context=None):
|
||||
|
@ -62,7 +63,7 @@ class JSONParser(BaseParser):
|
|||
|
||||
try:
|
||||
data = stream.read().decode(encoding)
|
||||
return json.loads(data)
|
||||
return json.loads(data, cls=self.decoder_class)
|
||||
except ValueError as exc:
|
||||
raise ParseError('JSON parse error - %s' % six.text_type(exc))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user