def flatten_json(json_dict, delim):
    """Flattens a JSON dictionary so it can be stored in a single table row

            Parameters:
            json_dict (dict): Holds the json data
            delim (string): The delimiter to be used to create flattened keys

            Returns:
            flattened_dict (dict): Holds the flattened dictionary
    """
    flattened_dict = {}
    for i in json_dict.keys():
        if isinstance(json_dict[i], dict):
            get = flatten_json(json_dict[i], delim)
            for j in get.keys():
                flattened_dict[i + delim + j] = get[j]
        else:
            flattened_dict[i] = json_dict[i]

    return flattened_dict