Reputation:
I am trying to read a JSON file into lists of Rows where each entry in the list is a single row from the file.
See code below
with open("C:\Users\Derrick.Speirs\Desktop\jcpenney_reviewers.json", "r") as fid: dat = [dict(json.loads(row)) for row in fid] print(dat) display(type(dat))
This code results in the following whereby each entry is not on a single row.
[{'ID': 'bkpn1412', 'DOB': '31.07.1988', 'State': 'Oregon', 'Reviewed': ['cea76118f6a9110a893de2b7654319c0']}, {'Usern
Any help appreciated thanks.
Upvotes: 1
Views: 321
Reputation: 333
with open("C:\\Users\\David.Johnson\\Desktop\\bigjohn.json", "r") as fid:
dat = [dict(json.loads(line)) for line in fid]
Using dict and zip might cause the issue
Upvotes: 1