import json


def load_json(file, dir=None):
    """ Loads json file into variable query

    Parameters
    ___________
    :param file:  string:  name of the json file without .json
    :param  dir:  string:  the directory the file is in

    Returns
    ___________
    :return:  query: the json file loaded
    """
    if dir is None:
        with open(f"{file}.json", "r") as r:
            data = json.load(r)
    else:
        with open(f"{dir}/{file}.json", "r") as r:
            data = json.load(r)
    return data