import json


def Set_dataset(inputDataset):
    """
    Sets active dataset in dataset.json
    """

    #assign dataset from user input
    dataset = inputDataset
    output = {"dataset": dataset}

    #read json from datasets.json file
    with open('datasets.json', 'r') as data_file:
        data = json.load(data_file)
        data_file.close()

    #assigns active dataset
    data["currentDataset"] = dataset

    #updates datasets.json file
    with open('datasets.json', 'w') as outfile:
        json.dump(data, outfile)
        outfile.close()

    #return output
    return output