@@ -230,39 +230,38 @@ Basic Usage
230
230
231
231
*object_hook * is an optional function that will be called with the result of
232
232
any object literal decoded (a :class: `dict `). The return value of
233
- *object_hook * will be used instead of the :class: `dict `. This feature can be used
234
- to implement custom decoders (e.g. `JSON-RPC < https://www.jsonrpc.org >`_
235
- class hinting).
233
+ *object_hook * will be used instead of the :class: `dict `. This feature can
234
+ be used to implement custom decoders (e.g. `JSON-RPC
235
+ <https://www.jsonrpc.org> `_ class hinting).
236
236
237
237
*object_pairs_hook * is an optional function that will be called with the
238
238
result of any object literal decoded with an ordered list of pairs. The
239
239
return value of *object_pairs_hook * will be used instead of the
240
- :class: `dict `. This feature can be used to implement custom decoders.
241
- If *object_hook * is also defined, the *object_pairs_hook * takes priority.
240
+ :class: `dict `. This feature can be used to implement custom decoders. If
241
+ *object_hook * is also defined, the *object_pairs_hook * takes priority.
242
242
243
243
.. versionchanged :: 3.1
244
244
Added support for *object_pairs_hook *.
245
245
246
- *parse_float *, if specified, will be called with the string of every JSON
247
- float to be decoded. By default, this is equivalent to `` float(num_str) ``.
248
- This can be used to use another datatype or parser for JSON floats
249
- (e.g. :class: `decimal.Decimal `).
246
+ *parse_float * is an optional function that will be called with the string of
247
+ every JSON float to be decoded. By default, this is equivalent to
248
+ `` float(num_str) ``. This can be used to use another datatype or parser for
249
+ JSON floats (e.g. :class: `decimal.Decimal `).
250
250
251
- *parse_int *, if specified, will be called with the string of every JSON int
252
- to be decoded. By default, this is equivalent to `` int(num_str) ``. This can
253
- be used to use another datatype or parser for JSON integers
254
- (e.g. :class: `float `).
251
+ *parse_int * is an optional function that will be called with the string of
252
+ every JSON int to be decoded. By default, this is equivalent to
253
+ `` int(num_str) ``. This can be used to use another datatype or parser for
254
+ JSON integers (e.g. :class: `float `).
255
255
256
256
.. versionchanged :: 3.11
257
257
The default *parse_int * of :func: `int ` now limits the maximum length of
258
258
the integer string via the interpreter's :ref: `integer string
259
259
conversion length limitation <int_max_str_digits>` to help avoid denial
260
260
of service attacks.
261
261
262
- *parse_constant *, if specified, will be called with one of the following
263
- strings: ``'-Infinity' ``, ``'Infinity' ``, ``'NaN' ``.
264
- This can be used to raise an exception if invalid JSON numbers
265
- are encountered.
262
+ *parse_constant * is an optional function that will be called with one of the
263
+ following strings: ``'-Infinity' ``, ``'Infinity' ``, ``'NaN' ``. This can be
264
+ used to raise an exception if invalid JSON numbers are encountered.
266
265
267
266
.. versionchanged :: 3.1
268
267
*parse_constant * doesn't get called on 'null', 'true', 'false' anymore.
@@ -334,34 +333,33 @@ Encoders and Decoders
334
333
It also understands ``NaN ``, ``Infinity ``, and ``-Infinity `` as their
335
334
corresponding ``float `` values, which is outside the JSON spec.
336
335
337
- *object_hook *, if specified, will be called with the result of every JSON
338
- object decoded and its return value will be used in place of the given
339
- :class: `dict `. This can be used to provide custom deserializations (e.g. to
340
- support `JSON-RPC <https://www.jsonrpc.org >`_ class hinting).
336
+ *object_hook * is an optional function that will be called with the result of
337
+ every JSON object decoded and its return value will be used in place of the
338
+ given :class: `dict `. This can be used to provide custom deserializations
339
+ (e.g. to support `JSON-RPC <https://www.jsonrpc.org >`_ class hinting).
341
340
342
- *object_pairs_hook *, if specified will be called with the result of every
343
- JSON object decoded with an ordered list of pairs. The return value of
344
- *object_pairs_hook * will be used instead of the :class: ` dict `. This
345
- feature can be used to implement custom decoders. If * object_hook * is also
346
- defined, the *object_pairs_hook * takes priority.
341
+ *object_pairs_hook * is an optional function that will be called with the
342
+ result of every JSON object decoded with an ordered list of pairs. The
343
+ return value of *object_pairs_hook * will be used instead of the
344
+ :class: ` dict `. This feature can be used to implement custom decoders. If
345
+ * object_hook * is also defined, the *object_pairs_hook * takes priority.
347
346
348
347
.. versionchanged :: 3.1
349
348
Added support for *object_pairs_hook *.
350
349
351
- *parse_float *, if specified, will be called with the string of every JSON
352
- float to be decoded. By default, this is equivalent to `` float(num_str) ``.
353
- This can be used to use another datatype or parser for JSON floats
354
- (e.g. :class: `decimal.Decimal `).
350
+ *parse_float * is an optional function that will be called with the string of
351
+ every JSON float to be decoded. By default, this is equivalent to
352
+ `` float(num_str) ``. This can be used to use another datatype or parser for
353
+ JSON floats (e.g. :class: `decimal.Decimal `).
355
354
356
- *parse_int *, if specified, will be called with the string of every JSON int
357
- to be decoded. By default, this is equivalent to `` int(num_str) ``. This can
358
- be used to use another datatype or parser for JSON integers
359
- (e.g. :class: `float `).
355
+ *parse_int * is an optional function that will be called with the string of
356
+ every JSON int to be decoded. By default, this is equivalent to
357
+ `` int(num_str) ``. This can be used to use another datatype or parser for
358
+ JSON integers (e.g. :class: `float `).
360
359
361
- *parse_constant *, if specified, will be called with one of the following
362
- strings: ``'-Infinity' ``, ``'Infinity' ``, ``'NaN' ``.
363
- This can be used to raise an exception if invalid JSON numbers
364
- are encountered.
360
+ *parse_constant * is an optional function that will be called with one of the
361
+ following strings: ``'-Infinity' ``, ``'Infinity' ``, ``'NaN' ``. This can be
362
+ used to raise an exception if invalid JSON numbers are encountered.
365
363
366
364
If *strict * is false (``True `` is the default), then control characters
367
365
will be allowed inside strings. Control characters in this context are
0 commit comments