Преобразование CSV в JSON.
import csv
import json
csvfile = open('file.csv', 'r')
jsonfile = open('file.json', 'w')
fieldnames = ("FirstName", "LastName", "IDNumber", "Message")
reader = csv.DictReader(csvfile, fieldnames)
for row in reader:
json.dump(row, jsonfile)
jsonfile.write('\n')
ИЛИ
Более выполнимое решение
import pandas as pd
df = pd.read_csv('final_coupa.csv')
df['json'] = df.apply(lambda x: x.to_json(), axis=1)
df['json'].to_csv('final_json', index=False)
Надеюсь, это поможет.