mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
Merge 89fa0d53cc
into d2286ba658
This commit is contained in:
commit
07ffec7fd0
|
@ -99,10 +99,17 @@ class JSONRenderer(BaseRenderer):
|
||||||
else:
|
else:
|
||||||
separators = INDENT_SEPARATORS
|
separators = INDENT_SEPARATORS
|
||||||
|
|
||||||
ret = json.dumps(
|
if type(data) is dict:
|
||||||
data, cls=self.encoder_class,
|
ret = json.dumps(
|
||||||
indent=indent, ensure_ascii=self.ensure_ascii,
|
data, cls=self.encoder_class,
|
||||||
separators=separators
|
indent=indent, ensure_ascii=self.ensure_ascii,
|
||||||
|
separators=separators, sort_keys=True
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
ret = json.dumps(
|
||||||
|
data, cls=self.encoder_class,
|
||||||
|
indent=indent, ensure_ascii=self.ensure_ascii,
|
||||||
|
separators=separators
|
||||||
)
|
)
|
||||||
|
|
||||||
# On python 2.x json.dumps() returns bytestrings if ensure_ascii=True,
|
# On python 2.x json.dumps() returns bytestrings if ensure_ascii=True,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user