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