mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #2515 -- Allow passing of options to JSON serializer. Thanks, nesh.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3795 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
96bc9ec79d
commit
d8b84cac91
3 changed files with 17 additions and 1 deletions
|
@ -96,6 +96,21 @@ Django "ships" with a few included serializers:
|
|||
.. _json: http://json.org/
|
||||
.. _simplejson: http://undefined.org/python/#simplejson
|
||||
|
||||
Notes For Specific Serialization Formats
|
||||
----------------------------------------
|
||||
|
||||
json
|
||||
~~~~
|
||||
|
||||
If you are using UTF-8 (or any other non-ASCII encoding) data with the JSON
|
||||
serializer, you must pass ``ensure_ascii=False`` as a parameter to the
|
||||
``serialize()`` call. Otherwise the output will not be encoded correctly.
|
||||
|
||||
For example::
|
||||
|
||||
json_serializer = serializers.get_serializer("json")
|
||||
json_serializer.serialize(queryset, ensure_ascii=False, stream=response)
|
||||
|
||||
Writing custom serializers
|
||||
``````````````````````````
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue