PyDocs

Nav

Internet Data Handling

JSONDecoder

json

class (source)
  • JSONDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None, array_hook=None)
Simple JSON <https://json.org> decoder

Performs the following translations in decoding by default:

+---------------+-------------------+
| JSON          | Python            |
+===============+===================+
| object        | dict              |
+---------------+-------------------+
| array         | list              |
+---------------+-------------------+
| string        | str               |
+---------------+-------------------+
| number (int)  | int               |
+---------------+-------------------+
| number (real) | float             |
+---------------+-------------------+
| true          | True              |
+---------------+-------------------+
| false         | False             |
+---------------+-------------------+
| null          | None              |
+---------------+-------------------+

It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as
their corresponding ``float`` values, which is outside the JSON spec.
Changed in 3.1, 3.6, 3.15
  • 3.1: Added support for object_pairs_hook.
  • 3.6: All parameters are now keyword-only.
  • 3.15: Added support for array_hook.
Members of JSONDecoder

d

decode
Return the Python representation of ``s`` (a ``str`` instance containing a JSON document).

r

raw_decode
Decode a JSON document from ``s`` (a ``str`` beginning with a JSON document) and return a 2-tuple of the Python representation and the index in ``s`` where the document ended.
0 Examples
No examples for json/JSONDecoder.
See Also
No see-alsos for json/JSONDecoder
0 Notes
No notes for JSONDecoder