import csv, json, os
base = os.path.dirname(__file__)
files = ["extractly_sourcemanual.csv","extractly_sourcemanuLocal.csv"]
for fname in files:
    path = os.path.join(base, fname)
    out = os.path.join(base, os.path.splitext(fname)[0] + ".json")
    if not os.path.exists(path):
        print(f"Missing: {path}")
        continue
    with open(path, newline='', encoding='utf-8') as f:
        reader = csv.DictReader(f)
        rows = list(reader)
    with open(out, 'w', encoding='utf-8') as fo:
        json.dump(rows, fo, ensure_ascii=False, indent=2)
    print(f"Wrote {out} ({len(rows)} rows)")
