multiple json records in a file

Solutions on MaxInterview for multiple json records in a file by the best coders in the world

showing results for - "multiple json records in a file"
Mats
16 Feb 2019
1import json
2
3studentsList = []
4print("Started Reading JSON file which contains multiple JSON document")
5with open('students.txt') as f:
6    for jsonObj in f:
7        studentDict = json.loads(jsonObj)
8        studentsList.append(studentDict)
9
10print("Printing each JSON Decoded Object")
11for student in studentsList:
12    print(student["id"], student["name"], student["class"], student["email"])