From 6d2bc6e80b53658bd249480c3e1172b7546caea1 Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Fri, 29 Mar 2013 03:59:29 +0200 Subject: [PATCH] #17438: add links to the conversion tables in dump(s)/load(s). --- Doc/library/json.rst | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 58eee18575..433f948ed8 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -124,7 +124,8 @@ Basic Usage sort_keys=False, **kw) Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting - :term:`file-like object`). + :term:`file-like object`) using this :ref:`conversion table + `. If *skipkeys* is ``True`` (default: ``False``), then dict keys that are not of a basic type (:class:`str`, :class:`int`, :class:`float`, :class:`bool`, @@ -183,8 +184,9 @@ Basic Usage indent=None, separators=None, default=None, \ sort_keys=False, **kw) - Serialize *obj* to a JSON formatted :class:`str`. The arguments have the - same meaning as in :func:`dump`. + Serialize *obj* to a JSON formatted :class:`str` using this :ref:`conversion + table `. The arguments have the same meaning as in + :func:`dump`. .. note:: @@ -204,7 +206,8 @@ Basic Usage .. function:: load(fp, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *fp* (a ``.read()``-supporting :term:`file-like object` - containing a JSON document) to a Python object. + containing a JSON document) to a Python object using this :ref:`conversion + table `. *object_hook* is an optional function that will be called with the result of any object literal decoded (a :class:`dict`). The return value of @@ -249,7 +252,7 @@ Basic Usage .. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *s* (a :class:`str` instance containing a JSON document) to a - Python object. + Python object using this :ref:`conversion table `. The other arguments have the same meaning as in :func:`load`, except *encoding* which is ignored and deprecated. @@ -264,6 +267,8 @@ Encoders and Decoders Performs the following translations in decoding by default: + .. _json-to-py-table: + +---------------+-------------------+ | JSON | Python | +===============+===================+ @@ -345,6 +350,8 @@ Encoders and Decoders Supports the following objects and types by default: + .. _py-to-json-table: + +-------------------+---------------+ | Python | JSON | +===================+===============+ -- 2.40.0