diff options
author | Petri Lehtinen <petri@digip.org> | 2012-08-28 09:34:09 (GMT) |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2012-08-28 09:34:09 (GMT) |
commit | a0578e94a444bf5019c9b1dcad562211895590bc (patch) | |
tree | 5c0128aac8964409c30400b8cd470d3c9735da84 /Doc | |
parent | 4f0338cab745c8678df4113f2fcd38dd234a73f8 (diff) | |
parent | 72b1426cfb6c19932f8303614720b2a528d1dd3c (diff) | |
download | cpython-a0578e94a444bf5019c9b1dcad562211895590bc.zip cpython-a0578e94a444bf5019c9b1dcad562211895590bc.tar.gz cpython-a0578e94a444bf5019c9b1dcad562211895590bc.tar.bz2 |
#11964: Document a change in v3.2 to the json indent parameter
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/json.rst | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst index a5bfcd2..95f120c 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -149,6 +149,9 @@ Basic Usage indents that many spaces per level. If *indent* is a string (such as ``"\t"``), that string is used to indent each level. + .. versionchanged:: 3.2 + Allow strings for *indent* in addition to integers. + If *separators* is an ``(item_separator, dict_separator)`` tuple, then it will be used instead of the default ``(', ', ': ')`` separators. ``(',', ':')`` is the most compact JSON representation. @@ -371,10 +374,15 @@ Encoders and Decoders will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis. - If *indent* is a non-negative integer (it is ``None`` by default), then JSON - array elements and object members will be pretty-printed with that indent - level. An indent level of 0 will only insert newlines. ``None`` is the most - compact representation. + If *indent* is a non-negative integer or string, then JSON array elements and + object members will be pretty-printed with that indent level. An indent level + of 0, negative, or ``""`` will only insert newlines. ``None`` (the default) + selects the most compact representation. Using a positive integer indent + indents that many spaces per level. If *indent* is a string (such as ``"\t"``), + that string is used to indent each level. + + .. versionchanged:: 3.2 + Allow strings for *indent* in addition to integers. If specified, *separators* should be an ``(item_separator, key_separator)`` tuple. The default is ``(', ', ': ')``. To get the most compact JSON |