I need to convert a csv file into a hierarchical JSON object (preferably using Python). I thought that the script I have (below) does a correct job of converting to JSON, bu
import csv
import json
file1 = csv.DictReader(open('filename.csv', 'r'))
output =[]
for each in complent:
row = {}
row['Id'] = each['Id']
row['Name'] = each['Name']
row['Address'] = each['Address']
row['Mobile'] = each['Mobile']
row['LandLine'] = each['LandLine']
row['Email'] = each['Email']
output.append(row)
json.dump(output,open('new_file.json','w'),indent=4,sort_keys=False)