CustomDecoder¶
- class CustomDecoder(*args, **kwargs)[source]¶
Bases:
json.decoder.JSONDecoder
Decoder for JSON with methods for datetimes
Methods
__init__
(*args, **kwargs)object_hook
, if specified, will be called with the result of every JSON object decoded and its return value will be used in place of the givendict
.decode
(s[, _w])Return the Python representation of
s
(astr
instance containing a JSON document).object_hook
(obj)Overload of object_hook function that deals with datetime.datetime
raw_decode
(s[, idx])Decode a JSON document from
s
(astr
beginning with a JSON document) and return a 2-tuple of the Python representation and the index ins
where the document ended.- decode(s, _w=<built-in method match of re.Pattern object>)¶
Return the Python representation of
s
(astr
instance containing a JSON document).
- raw_decode(s, idx=0)¶
Decode a JSON document from
s
(astr
beginning with a JSON document) and return a 2-tuple of the Python representation and the index ins
where the document ended.This can be used to decode a JSON document from a string that may have extraneous data at the end.