Python 3 Script to Convert Raw CSV to Json With Headers in Command Line
import csvimport json with open('input.csv') as f: columns = ("Column 1", "Column 2") reader = csv.DictReader(f, columns) tree = {} for row in reader: if row["Column 2"] is None: current = [] tree[row["Column 1"]] = current else: current.append(row)