json.load()

json.load(fp, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize fp (a .read()-supporting file-like object containing a JSON document) to a Python object using this conversion table. object_hook is an optional function that will be called with the result of any object literal decoded (a dict). The return value of object_hook will be used instead of the dict. This feature can be used to implement custom decoders (e.g. J

json.JSONEncoder.iterencode()

iterencode(o) Encode the given object, o, and yield each string representation as available. For example: for chunk in json.JSONEncoder().iterencode(bigobject): mysocket.write(chunk)

json.JSONEncoder.encode()

encode(o) Return a JSON string representation of a Python data structure, o. For example: >>> json.JSONEncoder().encode({"foo": ["bar", "baz"]}) '{"foo": ["bar", "baz"]}'

json.JSONEncoder.default()

default(o) Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError). For example, to support arbitrary iterators, you could implement default like this: def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, o)

json.JSONEncoder

class json.JSONEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) Extensible JSON encoder for Python data structures. Supports the following objects and types by default: Python JSON dict object list, tuple array str string int, float, int- & float-derived Enums number True true False false None null Changed in version 3.4: Added support for int- and float-derived Enum classes. To extend this to

json.JSONDecoder.raw_decode()

raw_decode(s) 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. This can be used to decode a JSON document from a string that may have extraneous data at the end.

json.JSONDecoder.decode()

decode(s) Return the Python representation of s (a str instance containing a JSON document). JSONDecodeError will be raised if the given JSON document is not valid.

json.JSONDecoder

class json.JSONDecoder(object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None) Simple JSON 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. object_hook, if specified, will be called with

json.JSONDecodeError.pos

pos The start index of doc where parsing failed.

json.JSONDecodeError.msg

msg The unformatted error message.