1

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.

1 Answer 1

1
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

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks. That sorrted it. Appreciated
I am glad I was able to help
The only issue now is each entry is not on a single row.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.