@@ -264,7 +264,7 @@ Basic Usage
264264
265265.. function :: load(fp, *, cls=None, object_hook=None, parse_float=None, \
266266 parse_int=None, parse_constant=None, \
267- object_pairs_hook=None, **kw)
267+ object_pairs_hook=None, array_hook=None, **kw)
268268
269269 Deserialize *fp * to a Python object
270270 using the :ref: `JSON-to-Python conversion table <json-to-py-table >`.
@@ -301,6 +301,15 @@ Basic Usage
301301 Default ``None ``.
302302 :type object_pairs_hook: :term: `callable ` | None
303303
304+ :param array_hook:
305+ If set, a function that is called with the result of
306+ any JSON array literal decoded with as a Python list.
307+ The return value of this function will be used
308+ instead of the :class: `list `.
309+ This feature can be used to implement custom decoders.
310+ Default ``None ``.
311+ :type array_hook: :term: `callable ` | None
312+
304313 :param parse_float:
305314 If set, a function that is called with
306315 the string of every JSON float to be decoded.
@@ -349,7 +358,10 @@ Basic Usage
349358 conversion length limitation <int_max_str_digits>` to help avoid denial
350359 of service attacks.
351360
352- .. function :: loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)
361+ .. versionchanged :: 3.15
362+ * Added the optional *array_hook * parameter.
363+
364+ .. function :: loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, array_hook=None, **kw)
353365
354366 Identical to :func: `load `, but instead of a file-like object,
355367 deserialize *s * (a :class: `str `, :class: `bytes ` or :class: `bytearray `
@@ -412,6 +424,14 @@ Encoders and Decoders
412424 .. versionchanged :: 3.1
413425 Added support for *object_pairs_hook *.
414426
427+ *array_hook * is an optional function that will be called with the
428+ result of every JSON array decoded as a list. The return value of
429+ *array_hook * will be used instead of the :class: `list `. This feature can be
430+ used to implement custom decoders.
431+
432+ .. versionchanged :: 3.15
433+ Added support for *array_hook *.
434+
415435 *parse_float * is an optional function that will be called with the string of
416436 every JSON float to be decoded. By default, this is equivalent to
417437 ``float(num_str) ``. This can be used to use another datatype or parser for
0 commit comments