@@ -258,64 +258,89 @@ Basic Usage
258258      the original one. That is, ``loads(dumps(x)) != x `` if x has non-string
259259      keys.
260260
261- .. function :: load(fp, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) 
261+ .. function :: load(fp, *, cls=None, object_hook=None, parse_float=None, \ 
262+                    parse_int=None, parse_constant=None, \
263+                    object_pairs_hook=None, **kw) 
262264
263-    Deserialize *fp * (a ``.read() ``-supporting :term: `text file ` or
264-    :term: `binary file ` containing a JSON document) to a Python object using
265-    this :ref: `conversion table  <json-to-py-table >`.
265+    Deserialize *fp * to a Python object
266+    using the :ref: `JSON-to-Python conversion table  <json-to-py-table >`.
266267
267-    *object_hook * is an optional function that will be called with the result of
268-    any object literal decoded (a :class: `dict `).  The return value of
269-    *object_hook * will be used instead of the :class: `dict `.  This feature can
270-    be used to implement custom decoders (e.g. `JSON-RPC 
271-    <https://www.jsonrpc.org> `_ class hinting).
268+    :param fp: 
269+       A ``.read() ``-supporting :term: `text file ` or :term: `binary file `
270+       containing the JSON document to be deserialized.
271+    :type fp:  :term: `file-like object `
272272
273-    *object_pairs_hook * is an optional function that will be called with the
274-    result of any object literal decoded with an ordered list of pairs.  The
275-    return value of *object_pairs_hook * will be used instead of the
276-    :class: `dict `.  This feature can be used to implement custom decoders.  If
277-    *object_hook * is also defined, the *object_pairs_hook * takes priority.
273+    :param cls: 
274+       If set, a custom JSON decoder.
275+       Additional keyword arguments to :func: `!load `
276+       will be passed to the constructor of *cls *.
277+       If ``None `` (the default), :class: `!JSONDecoder ` is used.
278+    :type cls:  a :class: `JSONDecoder ` subclass
279+ 
280+    :param object_hook: 
281+       If set, a function that is called with the result of
282+       any object literal decoded (a :class: `dict `).
283+       The return value of this function will be used
284+       instead of the :class: `dict `.
285+       This feature can be used to implement custom decoders,
286+       for example `JSON-RPC  <https://www.jsonrpc.org >`_ class hinting.
287+       Default ``None ``.
288+    :type object_hook:  :term: `callable ` | None
289+ 
290+    :param object_pairs_hook: 
291+       If set, a function that is called with the result of
292+       any object literal decoded with an ordered list of pairs.
293+       The return value of this function will be used
294+       instead of the :class: `dict `.
295+       This feature can be used to implement custom decoders.
296+       If *object_hook * is also set, *object_pairs_hook * takes priority.
297+       Default ``None ``.
298+    :type object_pairs_hook:  :term: `callable ` | None
299+ 
300+    :param parse_float: 
301+       If set, a function that is called with
302+       the string of every JSON float to be decoded.
303+       If ``None `` (the default), it is equivalent to ``float(num_str) ``.
304+       This can be used to parse JSON floats into custom datatypes,
305+       for example :class: `decimal.Decimal `.
306+    :type parse_float:  :term: `callable ` | None
307+ 
308+    :param parse_int: 
309+       If set, a function that is called with
310+       the string of every JSON int to be decoded.
311+       If ``None `` (the default), it is equivalent to ``int(num_str) ``.
312+       This can be used to parse JSON integers into custom datatypes,
313+       for example :class: `float `.
314+    :type parse_int:  :term: `callable ` | None
315+ 
316+    :param parse_constant: 
317+       If set, a function that is called with one of the following strings:
318+       ``'-Infinity' ``, ``'Infinity' ``, or ``'NaN' ``.
319+       This can be used to raise an exception
320+       if invalid JSON numbers are encountered.
321+       Default ``None ``.
322+    :type parse_constant:  :term: `callable ` | None
323+ 
324+    :raises JSONDecodeError: 
325+       When the data being deserialized is not a valid JSON document.
278326
279327   .. versionchanged :: 3.1 
280-       Added support for *object_pairs_hook *.
281328
282-    *parse_float * is an optional function that will be called with the string of
283-    every JSON float to be decoded.  By default, this is equivalent to
284-    ``float(num_str) ``.  This can be used to use another datatype or parser for
285-    JSON floats (e.g. :class: `decimal.Decimal `).
329+       * Added the optional *object_pairs_hook * parameter.
330+       * *parse_constant * doesn't get called on 'null', 'true', 'false' anymore.
286331
287-    *parse_int * is an optional function that will be called with the string of
288-    every JSON int to be decoded.  By default, this is equivalent to
289-    ``int(num_str) ``.  This can be used to use another datatype or parser for
290-    JSON integers (e.g. :class: `float `).
332+    .. versionchanged :: 3.6 
333+ 
334+       * All optional parameters are now :ref: `keyword-only  <keyword-only_parameter >`.
335+       * *fp * can now be a :term: `binary file `.
336+         The input encoding should be UTF-8, UTF-16 or UTF-32.
291337
292338   .. versionchanged :: 3.11 
293339      The default *parse_int * of :func: `int ` now limits the maximum length of
294340      the integer string via the interpreter's :ref: `integer string 
295341      conversion length limitation <int_max_str_digits>` to help avoid denial
296342      of service attacks.
297343
298-    *parse_constant * is an optional function that will be called with one of the
299-    following strings: ``'-Infinity' ``, ``'Infinity' ``, ``'NaN' ``.  This can be
300-    used to raise an exception if invalid JSON numbers are encountered.
301- 
302-    .. versionchanged :: 3.1 
303-       *parse_constant * doesn't get called on 'null', 'true', 'false' anymore.
304- 
305-    To use a custom :class: `JSONDecoder ` subclass, specify it with the ``cls ``
306-    kwarg; otherwise :class: `JSONDecoder ` is used.  Additional keyword arguments
307-    will be passed to the constructor of the class.
308- 
309-    If the data being deserialized is not a valid JSON document, a
310-    :exc: `JSONDecodeError ` will be raised.
311- 
312-    .. versionchanged :: 3.6 
313-       All optional parameters are now :ref: `keyword-only  <keyword-only_parameter >`.
314- 
315-    .. versionchanged :: 3.6 
316-       *fp * can now be a :term: `binary file `. The input encoding should be
317-       UTF-8, UTF-16 or UTF-32.
318- 
319344.. function :: loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) 
320345
321346   Deserialize *s * (a :class: `str `, :class: `bytes ` or :class: `bytearray `
0 commit comments