myjson

Module Contents

MODULE_TAG = __module__
CLASS_TAG = __class__
EXCLUDED_TAGS
_get_object_class(theObj)[source]
_get_object_module(theObj)[source]
_object_to_FQCN(theobj)[source]

Gets module path of object

_find_class(moduleName, className)[source]
json_to_obj(json_dict)[source]

Convenience class to create object from dictionary. Only works if CLASS_TAG is valid :param json_dict: dictionary loaded from a json file. :raise TypeError: if class can not be found :raise KeyError: if CLASS_TAG not present in dictionary

json_to_obj_safe(json_dict, cls)[source]

Safe class to create object from dictionary. :param json_dict: dictionary loaded from a json file :param cls: class object to instantiate with dictionary

obj_to_json(theObj)[source]

Extract the json dictionary from the object. The data saved are automatically detected, using typehints. ex: x: int=5 will be saved, x=5 won’t.

encode_str_json(theStr)[source]
decode_str_json(theStr)[source]
class Bar(num)
value :int