diff options
author | Anthony Sottile <asottile@umich.edu> | 2018-06-07 09:58:12 (GMT) |
---|---|---|
committer | INADA Naoki <methane@users.noreply.github.com> | 2018-06-07 09:58:12 (GMT) |
commit | bb6366bd7570ff3b74bc66095540bea78f31504e (patch) | |
tree | ca6380bbb2b83c4629f8a015173e0c959bbfac9d /Doc/library/json.rst | |
parent | cebe80b59b7386db3cce904d280dab61d1037e7a (diff) | |
download | cpython-bb6366bd7570ff3b74bc66095540bea78f31504e.zip cpython-bb6366bd7570ff3b74bc66095540bea78f31504e.tar.gz cpython-bb6366bd7570ff3b74bc66095540bea78f31504e.tar.bz2 |
bpo-17909: Document that json.load can accept a binary IO (GH-7366)
Diffstat (limited to 'Doc/library/json.rst')
-rw-r--r-- | Doc/library/json.rst | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/json.rst b/Doc/library/json.rst index 85798fa..d65fb3f 100644 --- a/Doc/library/json.rst +++ b/Doc/library/json.rst @@ -215,9 +215,9 @@ 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 using this :ref:`conversion - table <json-to-py-table>`. + Deserialize *fp* (a ``.read()``-supporting :term:`text file` or + :term:`binary file` containing a JSON document) to a Python object using + this :ref:`conversion table <json-to-py-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 @@ -262,6 +262,10 @@ Basic Usage .. versionchanged:: 3.6 All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`. + .. versionchanged:: 3.6 + *fp* can now be a :term:`binary file`. The input encoding should be + UTF-8, UTF-16 or UTF-32. + .. 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`, :class:`bytes` or :class:`bytearray` |