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:
Malcolm Tredinnick 2006-09-22 13:26:07 +00:00
parent 96bc9ec79d
commit d8b84cac91
3 changed files with 17 additions and 1 deletions

View file

@ -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
``````````````````````````