使用json数组,格式为:
[{"ID":"12345","Timestamp":"20140101", "Usefulness":"Yes", "Code":[{"event1":"A","result":"1"},…]},{"ID":"1A35B","Timestamp":"20140102", "Usefulness":"No", "Code":[{"event1":"B","result":"1"},…]},{"ID":"AA356","Timestamp":"20140103", "Usefulness":"No", "Code":[{"event1":"B","result":"0"},…]},...]然后将其导入到您的python代码中
import jsonwith open('file.json') as json_file: data = json.load(json_file)现在,数据的内容是一个带有字典的数组,字典表示每个元素。
您可以轻松访问它,即:
data[0]["ID"]



