don't bother sorting json keys when the json is minified

This commit is contained in:
jesopo 2019-09-10 15:08:06 +01:00
parent 9ac46bab7d
commit ef7da3409b

View file

@ -20,7 +20,7 @@ class Response(object):
self._data += data.encode("utf8") self._data += data.encode("utf8")
def write_json(self, obj): def write_json(self, obj):
if self._compact: if self._compact:
data = json.dumps(obj, sort_keys=True, separators=(",", ":")) data = json.dumps(obj, separators=(",", ":"))
else: else:
data = json.dumps(obj, sort_keys=True, indent=4) data = json.dumps(obj, sort_keys=True, indent=4)
self._data += data.encode("utf8") self._data += data.encode("utf8")