![]() ![]() ![]() Since I have more than 2000 rows, it is not a feasible solution.Ĭan anyone suggest how to parse CSV file line by line and convert it into JSON without specifying fieldnames? Answer by Milovan Tomašević Python CSV to JSON ![]() write ( ' \n ' )īut the problem with above code is that we need to mention the field names to parse the CSV. DictReader ( csvfile, fieldnames ) for row in reader : json. Import csv import json csvfile = open ( 'file.csv', 'r' ) jsonfile = open ( 'file.json', 'w' ) fieldnames = ( "FirstName", "LastName", "IDNumber", "Message" ) reader = csv. ![]()
0 Comments
Leave a Reply. |