def _deserialize_generic_json(element: Union[(str, dict, list)]) -> Union[(str, dict, list)]:
    '\n    Helper function to deserialize dictionaries or list with nested\n    json strings\n    :param element\n    '
    if isinstance(element, str):
        try:
            element = ast.literal_eval(element)
        except:
            try:
                element = jsonpickle.decode(element)
            except:
                return element
    if isinstance(element, dict):
        keys = element.keys()
    elif isinstance(element, list):
        keys = range(len(element))
    else:
        return element
    for k in keys:
        element[k] = _deserialize_generic_json(element[k])
    return element
Helper function to deserialize dictionaries or list with nested
json strings
:param element
def _deserialize_generic_json(element: Union[(str, dict, list)]) -> Union[(str, dict, list)]:
    '\n    Helper function to deserialize dictionaries or list with nested\n    json strings\n    :param element\n    '
    if isinstance(element, str):
        try:
            element = ast.literal_eval(element)
        except:
            try:
                element = jsonpickle.decode(element)
            except:
                return element
    if isinstance(element, dict):
        keys = element.keys()
    elif isinstance(element, list):
        keys = range(len(element))
    else:
        return element
    for k in keys:
        element[k] = _deserialize_generic_json(element[k])
    return element