summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-11-28 22:42:56 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-11-28 22:42:56 (GMT)
commit100314427a558be01bb42f8bdb4bab800cd114d2 (patch)
tree5a520cf84a80823bfcec7c58aafe2457effed1cd /Doc
parentd966c2156ad0bba85258262e5535912361cbd7b7 (diff)
downloadcpython-100314427a558be01bb42f8bdb4bab800cd114d2.zip
cpython-100314427a558be01bb42f8bdb4bab800cd114d2.tar.gz
cpython-100314427a558be01bb42f8bdb4bab800cd114d2.tar.bz2
#16333: use (",", ": ") as default separator when indent is specified to avoid trailing whitespace. Patch by Serhiy Storchaka.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/json.rst18
1 files changed, 13 insertions, 5 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst
index f9547cb..25a3358 100644
--- a/Doc/library/json.rst
+++ b/Doc/library/json.rst
@@ -155,9 +155,13 @@ Basic Usage
.. 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.
+ If specified, *separators* should be an ``(item_separator, key_separator)``
+ tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and
+ ``(',', ': ')`` otherwise. To get the most compact JSON representation,
+ you should specify ``(',', ':')`` to eliminate whitespace.
+
+ .. versionchanged:: 3.4
+ Use ``(',', ': ')`` as default if *indent* is not ``None``.
*default(obj)* is a function that should return a serializable version of
*obj* or raise :exc:`TypeError`. The default simply raises :exc:`TypeError`.
@@ -394,8 +398,12 @@ Encoders and Decoders
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
- representation, you should specify ``(',', ':')`` to eliminate whitespace.
+ tuple. The default is ``(', ', ': ')`` if *indent* is ``None`` and
+ ``(',', ': ')`` otherwise. To get the most compact JSON representation,
+ you should specify ``(',', ':')`` to eliminate whitespace.
+
+ .. versionchanged:: 3.4
+ Use ``(',', ': ')`` as default if *indent* is not ``None``.
If specified, *default* is a function that gets called for objects that can't
otherwise be serialized. It should return a JSON encodable version of the