Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-17909: Document that json.load can accept a binary IO (GH-7366)
(cherry picked from commit bb6366b)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
  • Loading branch information
asottile authored and miss-islington committed Jun 7, 2018
commit 446a11643cca3da24c69417073aa6b6b7891076e
10 changes: 7 additions & 3 deletions Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -264,6 +264,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`
Expand Down