CustomDecoder#

class CustomDecoder(*args, **kwargs)[source]#

Bases: json.decoder.JSONDecoder

Decoder for JSON with methods for datetimes

decode(s, _w=<built-in method match of re.Pattern object>)#

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

object_hook(obj: Any)[source]#

Overload of object_hook function that deals with datetime.datetime

Parameters

obj (dict) – Dict containing objects to decode from JSON

Returns

Dict with decoded object

Return type

dict

raw_decode(s, idx=0)#

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.