import json


def read(filename):
    """Import json TOUGH input file.
    
    Parameters
    ----------
    filename : str
        Input file name.
    
    Returns
    -------
    dict
        TOUGH input parameters.

    """

    def to_int(data):
        """Return dict with integer keys instead of strings."""
        return {int(k): data[k] for k in sorted(data.keys())}

    with open(filename, "r") as f:
        parameters = json.load(f)

    keys = {"extra_options", "more_options", "selections"}
    for key in keys:
        if key in parameters.keys():
            parameters[key] = to_int(parameters[key])

    return parameters