import pandas as pd
import json
csv_file = "name_searchspace.csv"
df = pd.read_csv(csv_file)

output = {}
for col in ["organic","cation","anion"]:
    unique_vals = df[col].dropna().unique()
    output[col.split("_")[0]] = unique_vals.tolist()

# save json
with open("options.json", "w") as f:
    json.dump(output, f, indent=2)