f = open(csv_filename, 'r')
csv_reader = csv.DictReader(f, fieldnames)
json_filename = csv_filename.split('.')[0] + '.json'
print(('Saving JSON to file: ', json_filename))
jsonf = open(json_filename, 'w')
data = json.dumps([r for r in csv_reader])
jsonf.write(data)
f.close()
jsonf.close()
csvfile = 'path/to/the/csv/file.csv'
field_names = ['a', 'list', 'of', 'fieldnames']
convert(csvfile, field_names)
ODS-файл в JSON