@@ -0,0 +1,998 @@
+import json%0Aimport unicodecsv as csv%0A%0A%0A## see: https://stackoverflow.com/a/28246154%0Adef flatten_json(b, delim):%0A    val = %7B%7D%0A    for i in b.keys():%0A        if isinstance(b%5Bi%5D, dict):%0A            get = flatten_json(b%5Bi%5D, delim)%0A            for j in get.keys():%0A                val%5Bi + delim + j%5D = get%5Bj%5D%0A        else:%0A            val%5Bi%5D = b%5Bi%5D%0A    return val%0A%0A%0Adef json_file_to_csv_file(in_path, out_path):%0A    f = open(in_path)%0A    data = json.load(f)%0A%0A    f = csv.writer(open(out_path, %22wb+%22))%0A    first_line = flatten_json(data%5B0%5D, '.')%0A    f.writerow(first_line.keys())%0A%0A    for line in data:%0A        line = flatten_json(line, '.')%0A        f.writerow(line.values())%0A%0A# paths without extension%0Apaths = %7B'ueberwachungspaket/data/government.json': 'ueberwachungspaket/static/data/government.csv',%0A         'ueberwachungspaket/data/representatives.json': 'ueberwachungspaket/static/data/representatives.csv'%7D%0Afor in_path, out_path in paths.iteritems():%0A    json_file_to_csv_file(in_path, out_path)%0A

add json to csv data conversion script