for line in f.readlines():
    lineItems = {}
for i, item in enumerate(line.split(',')):
    lineItems[headers[i]] = item
arr.append(lineItems)
f.close()
jsonText = json.dumps(arr)
print(jsonText)
Python - convert csv file to JSON