Skip to content

Commit

Permalink
[#3390] datastore dump: more compact json export
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Jan 6, 2017
1 parent 87eea9b commit a6b5951
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ckanext/datastore/writer.py
Expand Up @@ -92,7 +92,9 @@ def json_writer(response, columns, name=None, bom=False):
name=encode_rfc2231(name)))
if bom:
response.write(UTF8_BOM)
response.write(b'{\n "data": [')
response.write(
b'{\n "columns": %s,\n "data": [' % json.dumps(
columns, ensure_ascii=False, separators=(u',', u':')))
yield JSONWriter(response, columns)
response.write(b'\n]}\n')

Expand All @@ -110,7 +112,7 @@ def writerow(self, row):
else:
self.response.write(b',\n ')
self.response.write(json.dumps(
{k: v for (k, v) in zip(self.columns, row)},
row,
ensure_ascii=False,
separators=(u',', u':'),
sort_keys=True).encode(u'utf-8'))
Expand Down

0 comments on commit a6b5951

Please sign in to comment.