libs/json_lib.py
def jsonify_data(data):
    """Convert any data to a json structure

    Args:
        data ([type]): data to convert

    Returns:
        [type]: data converted as a json structure
    """
    if type(data) == list:
        result = [jsonify_data(x) for x in data]
    elif type(data) == dict:
        result = {jsonify_data(x):jsonify_data(y) for x,y in data.items()}
    elif type(data) == Row:
        result = dict(data)
    else:
        result = data

        if hasattr(data,"schema") or hasattr(data,"get_schema"):
            result = jsonify_database_models(data)
        elif hasattr(data,'_fields'):
            result = {x:data[i] for i,x in enumerate(data._fields)}
        
    return result
Convert any data to a json structure

    Args:
        data ([type]): data to convert

    Returns:
        [type]: data converted as a json structure
    
Convert any data to a json structure
Convert any data to a json structure
def jsonify_data(data):
    if type(data) == list:
        result = [jsonify_data(x) for x in data]
    elif type(data) == dict:
        result = {jsonify_data(x):jsonify_data(y) for x,y in data.items()}
    elif type(data) == Row:
        result = dict(data)
    else:
        result = data
        if hasattr(data,"schema") or hasattr(data,"get_schema"):
            result = jsonify_database_models(data)
        elif hasattr(data,'_fields'):
            result = {x:data[i] for i,x in enumerate(data._fields)}
    return result
def jsonify_data ( data ) : if type ( data ) == list : result = [ jsonify_data ( x ) for x in data ] elif type ( data ) == dict : result = { jsonify_data ( x ) : jsonify_data ( y ) for x , y in data . items ( ) } elif type ( data ) == Row : result = dict ( data ) else : result = data if hasattr ( data , "schema" ) or hasattr ( data , "get_schema" ) : result = jsonify_database_models ( data ) elif hasattr ( data , '_fields' ) : result = { x : data [ i ] for i , x in enumerate ( data . _fields ) } return result
Convert any data to a json structure
Convert any data to a json structure
"""Convert any data to a json structure

    Args:
        data ([type]): data to convert

    Returns:
        [type]: data converted as a json structure
    """
data converted as a json structure
data converted as a json structure
[type]
data
data to convert
data to convert