python load file with multiple jsons

Solutions on MaxInterview for python load file with multiple jsons by the best coders in the world

showing results for - "python load file with multiple jsons"
Cyril
26 May 2019
1import json
2json_list = []
3print("Started Reading JSON file which contains multiple JSON document")
4with open('your_file_with_multiple_jsons.extention') as f:
5    for json_obj in f:
6        a_dict = json.loads(json_obj)
7        json_list.append(a_dict)
8
9print("Printing each JSON Decoded Object")
10for js in json_list:
11    print(js["key1"]) # key2, key3 ...