def jsonify(dataset, variable):
    """
    Extract a time series from a THREDDS dataset at the given location.

    Args:
        dataset(xarray.Dataset): an xarray dataset.
        variable(str): Name of the variable to query.

    Returns:
        dict: JSON-compatible Python Dict.
    """
    str_time_da = dataset.time.dt.strftime('%Y-%m-%dT%H:%M:%SZ')
    json_dict = {
        'time_series': {
            'variable': variable,
            'datetime': str_time_da.data.tolist(),
            'values': dataset[variable].data.tolist(),
        }
    }

    return json_dict