tomchristie/django-rest-framework — pull request #1358 by nigma (2014-01-15 17:12:09+00:00)
Title: Allow to specify JSON separators for rendering

The [json.dumps](http://docs.python.org/2/library/json.html#json.dump) function takes an optional `separators` param that controls the JSON item_separator and dict_separator strings. Setting the separators to `(',', ':')` makes the renderer to produce the most compact encoding. For example:

```
>>> import json
>>> json.dumps([1,2,3,{'4': 5, '6': 7}], separators=(',', ':'))
'[1,2,3,{"4":5,"6":7}]'
```

This pull request does not alter the current behaviour and requires a user to opt-in by creating a custom renderer that overrides the `JSONRenderer.separators` attribute, but it might be worth to consider making the compact encoding the default one. Depending on the dataset, changing the separators to compact-ones reduces the output size by 5-8%.

Ref: http://docs.python.org/2.6/library/json.html - http://docs.python.org/3.3/library/json.html