I'm using the answer here to convert my csv to json in python .
How to convert CSV file to multiline JSON?
Although each json field is unique . I'm not sure how to ensure how each sub json field has a list of unique elements.
Ex:
fieldnames = ("domains","ip_address")
reader = csv.DictReader( csvfile, fieldnames)
for row in reader:
json.dump(row, jsonfile)
jsonfile.write('\n')
Basically I want to ensure all the items in the ip_address list are unique. In case of the list shown below :
{"ip_address":"x,y,x"}
It should be :
{"ip_address":"x,y"}
I know how to obtain unique values from a list. I want to know how to access this list while performing the json dump.