From e9b5456b5a5c3a4817f5274c6166553b1fba5305 Mon Sep 17 00:00:00 2001 From: n1jos Date: Fri, 29 May 2026 20:18:51 +0200 Subject: [PATCH] add csv to json python script --- scripts/csv_to_json.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 scripts/csv_to_json.py diff --git a/scripts/csv_to_json.py b/scripts/csv_to_json.py new file mode 100755 index 0000000..60e8c31 --- /dev/null +++ b/scripts/csv_to_json.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import csv, json, sys + +if len(sys.argv) != 3: + print("Usage: csv_to_json ") + sys.exit(1) + +with open(sys.argv[1]) as f: + data = list(csv.DictReader(f)) + +with open(sys.argv[2], 'w') as f: + json.dump(data, f, indent=2) \ No newline at end of file