Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions Doc/library/json.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,13 @@ Basic Usage
.. versionchanged:: 3.6
All optional parameters are now :ref:`keyword-only <keyword-only_parameter>`.

.. function:: loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
.. function:: loads(s, *, 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`
instance containing a JSON document) to a Python object using this
:ref:`conversion table <json-to-py-table>`.

The other arguments have the same meaning as in :func:`load`, except
*encoding* which is ignored and deprecated.
The other arguments have the same meaning as in :func:`load`.

If the data being deserialized is not a valid JSON document, a
:exc:`JSONDecodeError` will be raised.
Expand Down
3 changes: 1 addition & 2 deletions Lib/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def load(fp, *, cls=None, object_hook=None, parse_float=None,
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)


def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
def loads(s, *, cls=None, object_hook=None, parse_float=None,
parse_int=None, parse_constant=None, object_pairs_hook=None, **kw):
"""Deserialize ``s`` (a ``str``, ``bytes`` or ``bytearray`` instance
containing a JSON document) to a Python object.
Expand Down Expand Up @@ -330,7 +330,6 @@ def loads(s, *, encoding=None, cls=None, object_hook=None, parse_float=None,
To use a custom ``JSONDecoder`` subclass, specify it with the ``cls``
kwarg; otherwise ``JSONDecoder`` is used.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: remove this useless empty line too.

The ``encoding`` argument is ignored and deprecated.
"""
if isinstance(s, str):
if s.startswith('\ufeff'):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json.loads *encoding* keyword which was deprecated and ignored since Python
3.1 has been removed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Markup string can be used for linking. How about the below:

Removed the *encoding* keyword from :func:`json.loads`, it was deprecated
and ignored since Python 3.1. Patch by Matthias Bussonnier.