我想用python解析一个包含多个json根元素的json文件,但是我得到了这个错误:
json.decoder.JSONDecodeError: Extra data: line 325 column 2 (char 11121) multiple json objects下面是我正在尝试的代码:
data_json= json.load(open("C:/Users/myname/PycharmProjects/starting/newfile.json", 'r'))以下是json在文件中的示例:
{
"status": "OK",
"result": {
"data": {
"totalIncidents": 203.0,
"incidentItems": [
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657910,
"violatorId": "5",
"incidentId": "108662",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "LowMedium",
"priority": "None",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Low Cloud AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "Low_Medium",
"url": "https://securityindex.com",
"isWhitelisted": false,
"watchlisted": true,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657862,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203657742,
"violatorId": "1",
"incidentId": "108640",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "LowMedium",
"priority": "None",
"reason": [
"Number Of Threat: 1",
"Threat Model: Low Email AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "Low_Medium",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108640",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657697,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657576,
"violatorId": "5",
"incidentId": "108618",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "LowMedium",
"priority": "None",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Low Email AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "Low_Medium",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108618",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657529,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203657413,
"violatorId": "1",
"incidentId": "108596",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: Medium Email AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108596",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657366,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657239,
"violatorId": "5",
"incidentId": "108574",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Medium Email AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108574",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657190,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657050,
"violatorId": "5",
"incidentId": "108552",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Medium Cloud AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108552",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657009,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203656773,
"violatorId": "5",
"incidentId": "108530",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Medium Cloud AND PRI_SB"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108530",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": true,
"parentCaseId": "",
"casecreatetime": 1615203656733,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203656624,
"violatorId": "1",
"incidentId": "108508",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: Medium USB AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108508",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203656579,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203656478,
"violatorId": "1",
"incidentId": "108486",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: WeTransfer Blocked violations"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108486",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203656436,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203656327,
"violatorId": "1",
"incidentId": "108464",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: Medium CDDVD AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108464",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203656282,
"bulkactionallowed": true
}
]
}
}
},
{
"status": "OK",
"result": {
"data": {
"totalIncidents": 203.0,
"incidentItems": [
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657910,
"violatorId": "5",
"incidentId": "108662",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "LowMedium",
"priority": "None",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Low Cloud AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "Low_Medium",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108662",
"isWhitelisted": false,
"watchlisted": true,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657862,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203657742,
"violatorId": "1",
"incidentId": "108640",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "LowMedium",
"priority": "None",
"reason": [
"Number Of Threat: 1",
"Threat Model: Low Email AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "Low_Medium",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108640",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657697,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657576,
"violatorId": "5",
"incidentId": "108618",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "LowMedium",
"priority": "None",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Low Email AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "Low_Medium",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108618",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657529,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203657413,
"violatorId": "1",
"incidentId": "108596",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: Medium Email AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108596",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657366,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657239,
"violatorId": "5",
"incidentId": "108574",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Medium Email AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108574",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657190,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203657050,
"violatorId": "5",
"incidentId": "108552",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Medium Cloud AND PRI"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108552",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203657009,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest4 Account",
"lastUpdateDate": 1615203656773,
"violatorId": "5",
"incidentId": "108530",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Resource: HC_MWS1",
"Threat Model: Medium Cloud AND PRI_SB"
],
"violatorSubText": "666666666",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108530",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": true,
"parentCaseId": "",
"casecreatetime": 1615203656733,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203656624,
"violatorId": "1",
"incidentId": "108508",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: Medium USB AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108508",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203656579,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203656478,
"violatorId": "1",
"incidentId": "108486",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: WeTransfer Blocked violations"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108486",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203656436,
"bulkactionallowed": true
},
{
"violatorText": "UEBATest Account",
"lastUpdateDate": 1615203656327,
"violatorId": "1",
"incidentId": "108464",
"incidentStatus": "Open",
"riskscore": 0.0,
"assignedGroup": "SecOps",
"priority": "High",
"reason": [
"Number Of Threat: 1",
"Threat Model: Medium CDDVD AND PRI"
],
"violatorSubText": "888888888",
"entity": "Users",
"workflowName": "IDP",
"url": "https://securityindex.comSnypr/configurableDashboards/view?\u0026type\u003dincident\u0026id\u003d108464",
"isWhitelisted": false,
"watchlisted": false,
"tenantInfo": {
"tenantid": 1,
"tenantname": "DEV",
"tenantcolor": "#000000",
"tenantshortcode": "SE"
},
"statusCompleted": false,
"sandBoxPolicy": false,
"parentCaseId": "",
"casecreatetime": 1615203656282,
"bulkactionallowed": true
}
]
}
}
}发布于 2021-03-18 23:50:27
用文件开头的[和结尾的]包围json对象,使其成为json对象的数组,这样代码就知道要查找多个json对象。
https://stackoverflow.com/questions/66693749
复制相似问题