flexget.utils.json module#

Helper module that can load whatever version of the json module is available.

Plugins can just import the methods from this module.

Also allows date and datetime objects to be encoded/decoded.

class flexget.utils.json.DTDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)[source]#

Bases: JSONDecoder

decode(obj, **kwargs)[source]#

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

flexget.utils.json._datetime_decoder(dict_)[source]#
Parameters:

dict_ (dict)

Return type:

dict

flexget.utils.json._datetime_encoder(obj)[source]#
Parameters:

obj (datetime | date)

Return type:

str

flexget.utils.json._empty_unicode_decoder(dict_)[source]#
Parameters:

dict_ (dict)

Return type:

dict

flexget.utils.json.coerce(obj)[source]#

Coerce a data structure to a JSON serializable form.

Will recursively go through data structure, and attempt to turn anything not JSON serializable into a string.

Return type:

str | int | float | bool | dict | list | None

flexget.utils.json.dump(*args, **kwargs)[source]#
Return type:

None

flexget.utils.json.dumps(*args, **kwargs)[source]#
Return type:

str

flexget.utils.json.load(*args, **kwargs)[source]#
Parameters:

decode_datetime (bool) – If True, dates in ISO8601 format will be deserialized to datetime.datetime objects.

Return type:

Any

flexget.utils.json.loads(*args, **kwargs)[source]#
Parameters:

decode_datetime (bool) – If True, dates in ISO8601 format will be deserialized to datetime.datetime objects.

Return type:

Any