So I'm trying to load in the data in csvfile, convert it to a list of dictionaries and then save the result as JSON to jsonfile. This is what I have right now. When I try to open and load the json file, I get a "ValueError: No JSON object could be decoded" I'd appreciate any tips!
def csv_to_json(csvfile, jsonfile):
reader = csv.DictReader(csvfile.splitlines(), delimiter=' ', skipinitialspace=True,
fieldnames=['dept', 'code', 'section',
'name', 'instructor', 'type','location])
writer = csv.DictWriter(open(jsonfile,'wb'), fieldnames=reader.fieldnames)