For example: I have a program that generates usage logs like this in a JSON file. The JSON file log contains a lot of the same key called "activity" like the following:
"probe": "PROCESS_PROBE",
"status": "ProcessCreated",
"processName": "backgroundTaskHost.exe",
"path": "C:\\WINDOWS\\system32\\backgroundTaskHost.exe",
"creationClassName": "Win32_Process",
"handle": "21632",
"priority": "Normal",
"commandLine": "\"C:\\WINDOWS\\system32\\backgroundTaskHost.exe\" -ServerName:CortanaUI.AppXy7vb4pc2dr3kc93kfc509b1d0arkfb2x.mca",
"handleCount": 236,
"processId": 21632,
"parentProcessId": 112,
"pageFileUsage": 4244,
"creationDate": "20200410172922.614702+120",
"annotations": {
"userName": "datta",
"timeSinceStartup": 259878750,
"ticksOfEvent": 637221365629757593
}
},
"activity":{
"probe": "PROCESS_PROBE",
"status": "ProcessDeleted",
"processName": "RuntimeBroker.exe",
"path": "C:\\Windows\\System32\\RuntimeBroker.exe",
"creationClassName": "Win32_Process",
"handle": "8504",
"priority": "Normal",
"handleCount": 285,
"processId": 8504,
"parentProcessId": 112,
"pageFileUsage": 3180,
"creationDate": "20200410172757.934567+120",
"terminationDate": null,
"annotations": {
"userName": "datta",
"timeSinceStartup": 259883953,
"ticksOfEvent": 637221365681937472
}
},
"activity":{
"probe": "FILERESOURCE_PROBE",
"status": "Changed",
"path": "C:\\Users\\datta\\eclipse\\jee-2019-12",
"entityName": "eclipse",
"extension": "",
"attributes": "Directory",
"owner": "null",
"length": 0,
"isReadOnly": false,
"creationTime": "2020-01-17T09:42:08.5092897+01:00",
"lastWriteTime": "2020-03-25T10:56:10.7382329+01:00",
"lastAccessTime": "2020-04-10T17:29:29.9811767+02:00",
"annotations": {
"userName": "datta",
"timeSinceStartup": 259885750,
"ticksOfEvent": 637221365699837331
}
},
"activity":{
"probe": "FILERESOURCE_PROBE",
"status": "Changed",
"path": "C:\\Users\\datta\\eclipse",
"entityName": "jee-2019-12",
"extension": "",
"attributes": "Directory",
"owner": "null",
"length": 0,
"isReadOnly": false,
"creationTime": "2020-01-17T09:42:08.5083+01:00",
"lastWriteTime": "2020-01-17T09:42:08.5092897+01:00",
"lastAccessTime": "2020-04-10T17:29:29.9801436+02:00",
"annotations": {
"userName": "datta",
"timeSinceStartup": 259885750,
"ticksOfEvent": 637221365699906960
}
},
"activity":{
"probe": "FILERESOURCE_PROBE",
"status": "Changed",
"path": "C:\\Users\\datta",
"entityName": "eclipse",
"extension": "",
"attributes": "Directory",
"owner": "null",
"length": 0,
"isReadOnly": false,
"creationTime": "2020-01-17T09:42:08.5083+01:00",
"lastWriteTime": "2020-01-17T09:42:08.5083+01:00",
"lastAccessTime": "2020-04-10T17:29:29.9922013+02:00",
"annotations": {
"userName": "datta",
"timeSinceStartup": 259885765,
"ticksOfEvent": 637221365699922013
}
}
}
I would like to load them into a python program. Currently, I am using
logData = json.load(logfile)
to load it but the problem is when I do so, it returns me a python dict with only the last "activity" key and the rest of the "activity" keys get over-written. I don't know how to load all of them. I would appreciate if you guys can help me with that. Thank you.