diff options
author | Georg Brandl <georg@python.org> | 2010-10-15 17:03:02 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-10-15 17:03:02 (GMT) |
commit | d4460aaacdae40505a4645a73c021bfc810c9cb3 (patch) | |
tree | fbbeb729281e3db6bd5f013ceb6adf82cfd8339c /Doc/library/json.rst | |
parent | b67878a522a1686032d8ed4827438ede36068fe4 (diff) | |
download | cpython-d4460aaacdae40505a4645a73c021bfc810c9cb3.zip cpython-d4460aaacdae40505a4645a73c021bfc810c9cb3.tar.gz cpython-d4460aaacdae40505a4645a73c021bfc810c9cb3.tar.bz2 |
#4785: document strict argument of JSONDecoder, plus add object_pairs_hook in the docstrings.
Diffstat (limited to 'Doc/library/json.rst')
-rw-r--r-- | Doc/library/json.rst | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 3b203a2..a26001d 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -149,7 +149,7 @@ Basic Usage To use a custom :class:`JSONEncoder` subclass (e.g. one that overrides the :meth:`default` method to serialize additional types), specify it with the - *cls* kwarg. + *cls* kwarg; otherwise :class:`JSONEncoder` is used. .. function:: dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, **kw) @@ -195,8 +195,8 @@ Basic Usage are encountered. To use a custom :class:`JSONDecoder` subclass, specify it with the ``cls`` - kwarg. Additional keyword arguments will be passed to the constructor of the - class. + kwarg; otherwise :class:`JSONDecoder` is used. Additional keyword arguments + will be passed to the constructor of the class. .. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) @@ -275,6 +275,11 @@ Encoders and decoders ``'false'``. This can be used to raise an exception if invalid JSON numbers are encountered. + If *strict* is ``False`` (``True`` is the default), then control characters + will be allowed inside strings. Control characters in this context are + those with character codes in the 0-31 range, including ``'\t'`` (tab), + ``'\n'``, ``'\r'`` and ``'\0'``. + .. method:: decode(s) |