mirror of
https://github.com/django/django.git
synced 2025-07-27 07:03:55 +00:00
Fixed #6234 -- Removed obsolete note about json and ensure_ascii
Thanks aaron at cellmap.ca for the report.
This commit is contained in:
parent
fc10418fba
commit
4e8d9524c6
1 changed files with 0 additions and 9 deletions
|
@ -166,15 +166,6 @@ Notes for specific serialization formats
|
||||||
json
|
json
|
||||||
^^^^
|
^^^^
|
||||||
|
|
||||||
If you're 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 won't be encoded correctly.
|
|
||||||
|
|
||||||
For example::
|
|
||||||
|
|
||||||
json_serializer = serializers.get_serializer("json")()
|
|
||||||
json_serializer.serialize(queryset, ensure_ascii=False, stream=response)
|
|
||||||
|
|
||||||
Be aware that not all Django output can be passed unmodified to :mod:`json`.
|
Be aware that not all Django output can be passed unmodified to :mod:`json`.
|
||||||
In particular, :ref:`lazy translation objects <lazy-translations>` need a
|
In particular, :ref:`lazy translation objects <lazy-translations>` need a
|
||||||
`special encoder`_ written for them. Something like this will work::
|
`special encoder`_ written for them. Something like this will work::
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue