Document to_json will convert to ASCII strings by default (#70954)
... as reported in issue #68702
This commit is contained in:
parent
e28b20d729
commit
8c48366f1c
1 changed files with 18 additions and 0 deletions
|
@ -240,6 +240,24 @@ for example::
|
|||
- set_fact:
|
||||
myvar: "{{ result.stdout | from_json }}"
|
||||
|
||||
|
||||
Filter `to_json` and Unicode support
|
||||
------------------------------------
|
||||
|
||||
By default `to_json` and `to_nice_json` will convert data received to ASCII, so::
|
||||
|
||||
{{ 'München'| to_json }}
|
||||
|
||||
will return::
|
||||
|
||||
'M\u00fcnchen'
|
||||
|
||||
To keep Unicode characters, pass the parameter `ensure_ascii=False` to the filter::
|
||||
|
||||
{{ 'München'| to_json(ensure_ascii=False) }}
|
||||
|
||||
'München'
|
||||
|
||||
.. versionadded:: 2.7
|
||||
|
||||
To parse multi-document YAML strings, the ``from_yaml_all`` filter is provided.
|
||||
|
|
Loading…
Reference in a new issue