[ckan-dev] Ckan JSON output

Toby Dacre toby.okfn at gmail.com
Thu Jun 27 08:35:08 UTC 2013


JSON output from the api has been changed to now display utf-8 chars
correctly in https://github.com/okfn/ckan/pull/846 This is targeted at
CKAN 2.2 unless Adriá feels like taking it for 2.1

output was:
 {..., "type": "Jeu de donn\u00e9es (S\u00e9rie de donn\u00e9es)" , ...}

new output:
 {..., "type": "Jeu de données (Série de données)", ...}

This may cause some problems for existing applications using the api
but the change feels worthwhile.  The only changes to the tests was
`msg = msg.decode('utf-8')` in one file

Following on from this I would like to change the JSON output to be
more user friendly.  The basic change would be to change
`json.dumps(response_data)` to
`json.dumps(response_data, sort_keys=True, indent=2, separators=(',', ': '))`

So basically the output would be multi-line and much more human readable

but this is a much bigger change and breaks a huge number of tests
(mainly I suspect because they are poorly written)

Does this seem to be a useful change?  Would we want a config option
to retain existing behaviour? or do we want to do this via a param eg
?readable=true

-- 
Toby Dacre

The Open Knowledge Foundation

Empowering through Open Knowledge
http://okfn.org/  |  @okfn




More information about the ckan-dev mailing list