diff options
| author | Tom Christie | 2014-11-03 14:36:06 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-11-03 14:36:06 +0000 |
| commit | b106ebd2c0a19107f12d5b87cfbe0083aaaa60b9 (patch) | |
| tree | 736da30fadc813385cc2359caeb30a8ef5d422cb /docs/api-guide/renderers.md | |
| parent | 650a91ac24cbd3e5b4ad5d7d7c6706fdf6160a78 (diff) | |
| parent | 8861a7dfc757a88335048aa7bbccfc8a77850c48 (diff) | |
| download | django-rest-framework-b106ebd2c0a19107f12d5b87cfbe0083aaaa60b9.tar.bz2 | |
Merge pull request #1800 from tomchristie/version-3.0
Version 3.0
Diffstat (limited to 'docs/api-guide/renderers.md')
| -rw-r--r-- | docs/api-guide/renderers.md | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/docs/api-guide/renderers.md b/docs/api-guide/renderers.md index 20eed70d..db7436c2 100644 --- a/docs/api-guide/renderers.md +++ b/docs/api-guide/renderers.md @@ -74,37 +74,18 @@ If your API includes views that can serve both regular webpages and API response Renders the request data into `JSON`, using utf-8 encoding. -Note that non-ascii characters will be rendered using JSON's `\uXXXX` character escape. For example: +Note that the default style is to include unicode characters, and render the response using a compact style with no unnecessary whitespace: - {"unicode black star": "\u2605"} + {"unicode black star":"★","value":999} The client may additionally include an `'indent'` media type parameter, in which case the returned `JSON` will be indented. For example `Accept: application/json; indent=4`. { - "unicode black star": "\u2605" + "unicode black star": "★", + "value": 999 } -**.media_type**: `application/json` - -**.format**: `'.json'` - -**.charset**: `None` - -## UnicodeJSONRenderer - -Renders the request data into `JSON`, using utf-8 encoding. - -Note that non-ascii characters will not be character escaped. For example: - - {"unicode black star": "★"} - -The client may additionally include an `'indent'` media type parameter, in which case the returned `JSON` will be indented. For example `Accept: application/json; indent=4`. - - { - "unicode black star": "★" - } - -Both the `JSONRenderer` and `UnicodeJSONRenderer` styles conform to [RFC 4627][rfc4627], and are syntactically valid JSON. +The default JSON encoding style can be altered using the `UNICODE_JSON` and `COMPACT_JSON` settings keys. **.media_type**: `application/json` |
