import json


def get_json_columns(json_file_or_dict, check_row_count=1):
    """Determines the names of columns in a JSON file

    Args:
        json_file_or_dict (str or dict): The file name of the JSON file, or a dict
        check_row_count (int, optional): The number of rows to use to get columns

    Returns:
        list of str: A list of the column names
    """
    # Likely to be pretty slow. Hopefully only runs on guess?
    columns = set()
    if isinstance(json_file_or_dict, str):
        with open(json_file_or_dict, 'r') as json_file:
            j = json.loads(json_file.read())
    else:
        j = json_file_or_dict

    for index, record in enumerate(j):
        if index >= check_row_count:
            break
        columns = columns | set(record.keys())

    return columns