import json


def get_scan_fields(series,fieldnames):
    """
        For applying to each row of a dataframe.
        The field is extracted from the json and added to the
        sub_sess tsv.
    """
    json_path = series.json_path
    
    with json_path.open() as j:    
        data = json.load(j)
        for f in fieldnames:
            val = data[f]
            series[f] = val
    return series