用于验证JSON和正确JSON的python脚本

2024-05-20 01:06:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我想将部分json文件转换为正确的json文件,我的部分json文件是由avro工具生成的,目前它[在文件开头和]在文件结尾处缺失,也没有,在每个记录之后,因此当我验证json时,它给出了错误,我需要python脚本来纠正100多个文件的这些错误,我的剧本看起来像-

import json
def validate(filename):
    with open(filename) as file:
        try:
            return json.load(file) # put JSON-data to a variable
        except json.decoder.JSONDecodeError:
            print("Invalid JSON") # in case json is invalid
        else:
            print("Valid JSON") # in case json is valid
            
if __name__ == "__main__":
    validate("filename.json")

我的json文件看起来像-

{"SequenceNumber":1,"Offset":"2","EnqueuedTimeUtc":"11/10/2020 7:32:52 AM","SystemProperties":{},"Properties":{},"Body":{"bytes":"{\"records\": [{ \"time\": \"2020-11-10T07:25:59.2626144Z\", \"resourceId\": \"/SUBSCRIPTIONS/aa-aaa-aa-8D80-aa/aa/CLOUD-SHELL-aa-WESTUS/aa/a.STORAGE/aa/aa\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Start\", \"resultSignature\": \"Started.\", \"durationMs\": \"0\", \"callerIpAddress\": \"2233\", \"correlationId\": \"zdsfs-8fca-fsd-abe5-dfsf\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/cc-cc-cc-cc-cc/resourceGroups/cloud-shell-storage-westus/providers/Microsoft.Storage/storageAccounts/cs4770befb19c7ex45d3x8d8\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"evidence\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/qq-9c7e-45d3-8d80-ww\",\"roleAssignmentId\":\"0cef391395014576b7d447be2a5c24e2\",\"roleDefinitionId\":\"gffgfgfdddd\",\"principalId\":\"fhtdfgfgdf\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/fdfs-fdfd-fdfds-fdfdsf-fdsdsf/\",\"iat\":\"3433\",\"nbf\":\"4322\",\"exp\":\"3423234\",\"aio\":\"gdffdgfd+n9V/8EbZ5HPiAA==\",\"appid\":\"7dff047a-5bf3-4772-939f-65ffe84316f0\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/b9921086-ff77-4d0d-828a-cb3381f678e2/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"rh\":\"0.AAAAhhCSuXf_DU2CisszgfZ44noE_33zW3JHk59l_-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"b9921086-ff77-4d0d-828a-cb3381f678e2\",\"uti\":\"nCMX3DhqM0eIg_OH8qgVAA\",\"ver\":\"1.0\",\"xms_tcdt\":\"1440769760\"}}, \"level\": \"Information\", \"properties\": {\"eventCategory\":\"Administrative\",\"entity\":\"/subscriptions/770befb1-9c7e-45d3-8d80-abbc1666f98f/resourceGroups/cloud-shell-storage-westus/providers/Microsoft.Storage/storageAccounts/cs4770befb19c7ex45d3x8d8\",\"message\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"hierarchy\":\"b9921086-ff77-4d0d-828a-cb3381f678e2/Corporate-Default/Azure-BU-Standard\"}},{ \"time\": \"2020-11-10T07:25:59.3526439Z\", \"resourceId\": \"/SUBSCRIPTIONS/770BEFB1-9C7E-45D3-8D80-ABBC1666F98F/RESOURCEGROUPS/CLOUD-SHELL-STORAGE-WESTUS/PROVIDERS/MICROSOFT.STORAGE/STORAGEACCOUNTS/eee\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Success\", \"resultSignature\": \"Succeeded.OK\", \"durationMs\": \"90\", \"callerIpAddress\": \"46464\", \"correlationId\": \"ee-8fca-44e8-abe5-eee\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/ee-ee-ee-ee-ee/resourceGroups/cloud-shell-storage-westus/providers/Microsoft.Storage/storageAccounts/cs4770befb19c7ex45d3x8d8\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"evidence\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/ee-ee-ee-ee-ee\",\"roleAssignmentId\":\"ee\",\"roleDefinitionId\":\"ee\",\"principalId\":\"ee\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/ee-ee-ee-ee-3232/\",\"iat\":\"232\",\"nbf\":\"4545\",\"exp\":\"33\",\"aio\":\"dd+dd/dd==\",\"appid\":\"dd-dd-dd-dd-ddd\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/dd-dd-dd-dd-dd/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"dd-dd-dd-dd-dd\",\"rh\":\"0.dd-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"ffd-fd-sdfd-fdfd-sdfs\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"fdsfd-df-fds-fd-fdfsd\",\"uti\":\"fdsd\",\"ver\":\"1.0\",\"xms_tcdt\":\"434\"}}, \"level\": \"Information\", \"properties\": {\"statusCode\":\"OK\",\"serviceRequestId\":\"aa-aa-aa-aa-aa\",\"sw\":\"ad\",\"entity\":\"/subscriptions/ss-ss-ss-ss-ss/resourceGroups/cloud-shell-storage-westus/providers/ss.ss/ss/ss\",\"message\":\"ss.ssss/ss/ss/action\",\"hierarchy\":\"ss-ss-ss-ss-ss/ss-ss/ss-ss-ss\"}}]}"}}

{"SequenceNumber":3,"Offset":"3","EnqueuedTimeUtc":"11/10/2020 7:33:37 AM","SystemProperties":{},"Properties":{},"Body":{"bytes":"{\"records\": [{ \"time\": \"2020-11-10T07:25:57.0029630Z\", \"resourceId\": \"/SUBSCRIPTIONS/aa-aa-aa-8D80-aa/aa/aa/PROaaVIDERS/MICROSOFT.STORAGE/ww/tt\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Start\", \"resultSignature\": \"Started.\", \"durationMs\": \"0\", \"callerIpAddress\": \"3453\", \"correlationId\": \"cc-cc-cc-cc-cc\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/cc-9c7e-45d3-8d80-sdfds/resourceGroups/Telemetry/providers/Microsoft.Storage/tt/tt\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"tt\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/qq-9c7e-qq-8d80-ww\",\"roleAssignmentId\":\"qqqq\",\"roleDefinitionId\":\"ww\",\"principalId\":\"ww\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/fddfd-ff77-4fds-fdfs-fdsfsd/\",\"iat\":\"3344\",\"nbf\":\"432\",\"exp\":\"43432\",\"aio\":\"fds+n9V/fdsf==\",\"appid\":\"dgfgfd-gfdg-fdgf-939f-fgfdgd\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/b9921086-ff77-4d0d-828a-cb3381f678e2/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"rh\":\"0.AAAAhhCSuXf_DU2CisszgfZ44noE_33zW3JHk59l_-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"defsd-fds-fsd-998b-7cf964b4fd3f\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"fdsfs-dsf-fds-fds-cb3381f678e2\",\"uti\":\"nCMX3DhqM0eIg_OH8qgVAA\",\"ver\":\"1.0\",\"xms_tcdt\":\"1440769760\"}}, \"level\": \"Information\", \"properties\": {\"eventCategory\":\"Administrative\",\"entity\":\"/subscriptions/ewd-fd-fd-fdfs-dsfsfds/resourceGroups/Telemetry/providers/Microsoft.Storage/storageAccounts/testapplicationsfstorage\",\"message\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"hierarchy\":\"dsfsd-fds-4d0d-828a-fdss/Corporate-Default/Azure-BU-Standard\"}},{ \"time\": \"2020-11-10T07:25:57.0379585Z\", \"resourceId\": \"/SUBSCRIPTIONS/fds-fsd-fd-fd-fdsf/RESOURCEGROUPS/TELEMETRY/PROVIDERS/MICROSOFT.STORAGE/STORAGEACCOUNTS/TESTAPPLICATIONSFSTORAGE\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Success\", \"resultSignature\": \"Succeeded.OK\", \"durationMs\": \"36\", \"callerIpAddress\": \"4646\", \"correlationId\": \"fsdfsd-a1ca-4a6b-a68d-fdsfd\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/fdfs-9c7e-fdsf-fsdf-fdsfs/resourceGroups/Telemetry/providers/Microsoft.Storage/storageAccounts/testapplicationsfstorage\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"evidence\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/sfds-fsdfs-sdf-sdf-fsdfs\",\"roleAssignmentId\":\"sfsd\",\"roleDefinitionId\":\"sdfsds\",\"principalId\":\"fsfs\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/sdf-fsdf-fsdf-sdfd-sfd/\",\"iat\":\"1604990585\",\"nbf\":\"321313\",\"exp\":\"3434\",\"aio\":\"fsd+fsd/fsd==\",\"appid\":\"wsf-5bf3-4772-939f-65ffe84316f0\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/b9921086-ff77-4d0d-828a-sdf/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"sfd-fsd-fsd-fsd-fsdf\",\"rh\":\"0.sdfsd-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"sfds-ff77-4d0d-sfd-fsdfs\",\"uti\":\"fsdfs\",\"ver\":\"1.0\",\"xms_tcdt\":\"464\"}}, \"level\": \"Information\", \"properties\": {\"statusCode\":\"OK\",\"serviceRequestId\":\"fdsd-fsdf-fds-887c-sdf\",\"eventCategory\":\"Administrative\",\"entity\":\"/subscriptions/sdfs-fdsf-sdf-fdsfsd-abbc1666f98f/resourceGroups/Telemetry/providers/Microsoft.Storage/storageAccounts/testapplicationsfstorage\",\"message\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"hierarchy\":\"ss-ss-ss-ss-ss/Corporate-Default/ss-BU-ss\"}}]}"}}

Tags: httpscomhttpsubscriptionsactionstorageschemasss
1条回答
网友
1楼 · 发布于 2024-05-20 01:06:52

尽管ndjson规范提供了忽略空行的选项,但ndjson包尚未实现这一点。所以一行一行地解析它

import json
def validate(filename):
    with open(filename) as file:
        try:
            return json.load(file) # put JSON-data to a variable
        except json.decoder.JSONDecodeError:
            print("Invalid JSON, trying to parse as NDJSON with empty lines") # in case json is invalid
            file.seek(0) # return to start of file
            try:
                data =[json.loads(line) for line in file if line.strip()]
                print('Succesfully converted from NDJSON with empty lines to JSON')
                return data
            except json.decoder.JSONDecodeError:
                print("Invalid JSON, trying to parse as NDJSON")

        else:
            print("Valid JSON") # in case json is valid
            
if __name__ == "__main__":
    data = validate("sample.ndjson")
    print(data)

编辑:因为OP对JSON缺乏了解,如果你这样做的话,会在评论中抱怨

with open('sample2.json', 'w') as f:
    json.dump(data, f, indent=4)

其中data是来自validate()的返回值,您在sample2.json文件中得到的输出如下所示:

[
    {
        "SequenceNumber": 1,
        "Offset": "2",
        "EnqueuedTimeUtc": "11/10/2020 7:32:52 AM",
        "SystemProperties": {},
        "Properties": {},
        "Body": {
            "bytes": "{\"records\": [{ \"time\": \"2020-11-10T07:25:59.2626144Z\", \"resourceId\": \"/SUBSCRIPTIONS/aa-aaa-aa-8D80-aa/aa/CLOUD-SHELL-aa-WESTUS/aa/a.STORAGE/aa/aa\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Start\", \"resultSignature\": \"Started.\", \"durationMs\": \"0\", \"callerIpAddress\": \"2233\", \"correlationId\": \"zdsfs-8fca-fsd-abe5-dfsf\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/cc-cc-cc-cc-cc/resourceGroups/cloud-shell-storage-westus/providers/Microsoft.Storage/storageAccounts/cs4770befb19c7ex45d3x8d8\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"evidence\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/qq-9c7e-45d3-8d80-ww\",\"roleAssignmentId\":\"0cef391395014576b7d447be2a5c24e2\",\"roleDefinitionId\":\"gffgfgfdddd\",\"principalId\":\"fhtdfgfgdf\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/fdfs-fdfd-fdfds-fdfdsf-fdsdsf/\",\"iat\":\"3433\",\"nbf\":\"4322\",\"exp\":\"3423234\",\"aio\":\"gdffdgfd+n9V/8EbZ5HPiAA==\",\"appid\":\"7dff047a-5bf3-4772-939f-65ffe84316f0\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/b9921086-ff77-4d0d-828a-cb3381f678e2/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"rh\":\"0.AAAAhhCSuXf_DU2CisszgfZ44noE_33zW3JHk59l_-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"b9921086-ff77-4d0d-828a-cb3381f678e2\",\"uti\":\"nCMX3DhqM0eIg_OH8qgVAA\",\"ver\":\"1.0\",\"xms_tcdt\":\"1440769760\"}}, \"level\": \"Information\", \"properties\": {\"eventCategory\":\"Administrative\",\"entity\":\"/subscriptions/770befb1-9c7e-45d3-8d80-abbc1666f98f/resourceGroups/cloud-shell-storage-westus/providers/Microsoft.Storage/storageAccounts/cs4770befb19c7ex45d3x8d8\",\"message\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"hierarchy\":\"b9921086-ff77-4d0d-828a-cb3381f678e2/Corporate-Default/Azure-BU-Standard\"}},{ \"time\": \"2020-11-10T07:25:59.3526439Z\", \"resourceId\": \"/SUBSCRIPTIONS/770BEFB1-9C7E-45D3-8D80-ABBC1666F98F/RESOURCEGROUPS/CLOUD-SHELL-STORAGE-WESTUS/PROVIDERS/MICROSOFT.STORAGE/STORAGEACCOUNTS/eee\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Success\", \"resultSignature\": \"Succeeded.OK\", \"durationMs\": \"90\", \"callerIpAddress\": \"46464\", \"correlationId\": \"ee-8fca-44e8-abe5-eee\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/ee-ee-ee-ee-ee/resourceGroups/cloud-shell-storage-westus/providers/Microsoft.Storage/storageAccounts/cs4770befb19c7ex45d3x8d8\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"evidence\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/ee-ee-ee-ee-ee\",\"roleAssignmentId\":\"ee\",\"roleDefinitionId\":\"ee\",\"principalId\":\"ee\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/ee-ee-ee-ee-3232/\",\"iat\":\"232\",\"nbf\":\"4545\",\"exp\":\"33\",\"aio\":\"dd+dd/dd==\",\"appid\":\"dd-dd-dd-dd-ddd\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/dd-dd-dd-dd-dd/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"dd-dd-dd-dd-dd\",\"rh\":\"0.dd-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"ffd-fd-sdfd-fdfd-sdfs\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"fdsfd-df-fds-fd-fdfsd\",\"uti\":\"fdsd\",\"ver\":\"1.0\",\"xms_tcdt\":\"434\"}}, \"level\": \"Information\", \"properties\": {\"statusCode\":\"OK\",\"serviceRequestId\":\"aa-aa-aa-aa-aa\",\"sw\":\"ad\",\"entity\":\"/subscriptions/ss-ss-ss-ss-ss/resourceGroups/cloud-shell-storage-westus/providers/ss.ss/ss/ss\",\"message\":\"ss.ssss/ss/ss/action\",\"hierarchy\":\"ss-ss-ss-ss-ss/ss-ss/ss-ss-ss\"}}]}"
        }
    },
    {
        "SequenceNumber": 3,
        "Offset": "3",
        "EnqueuedTimeUtc": "11/10/2020 7:33:37 AM",
        "SystemProperties": {},
        "Properties": {},
        "Body": {
            "bytes": "{\"records\": [{ \"time\": \"2020-11-10T07:25:57.0029630Z\", \"resourceId\": \"/SUBSCRIPTIONS/aa-aa-aa-8D80-aa/aa/aa/PROaaVIDERS/MICROSOFT.STORAGE/ww/tt\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Start\", \"resultSignature\": \"Started.\", \"durationMs\": \"0\", \"callerIpAddress\": \"3453\", \"correlationId\": \"cc-cc-cc-cc-cc\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/cc-9c7e-45d3-8d80-sdfds/resourceGroups/Telemetry/providers/Microsoft.Storage/tt/tt\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"tt\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/qq-9c7e-qq-8d80-ww\",\"roleAssignmentId\":\"qqqq\",\"roleDefinitionId\":\"ww\",\"principalId\":\"ww\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/fddfd-ff77-4fds-fdfs-fdsfsd/\",\"iat\":\"3344\",\"nbf\":\"432\",\"exp\":\"43432\",\"aio\":\"fds+n9V/fdsf==\",\"appid\":\"dgfgfd-gfdg-fdgf-939f-fgfdgd\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/b9921086-ff77-4d0d-828a-cb3381f678e2/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"rh\":\"0.AAAAhhCSuXf_DU2CisszgfZ44noE_33zW3JHk59l_-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"defsd-fds-fsd-998b-7cf964b4fd3f\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"fdsfs-dsf-fds-fds-cb3381f678e2\",\"uti\":\"nCMX3DhqM0eIg_OH8qgVAA\",\"ver\":\"1.0\",\"xms_tcdt\":\"1440769760\"}}, \"level\": \"Information\", \"properties\": {\"eventCategory\":\"Administrative\",\"entity\":\"/subscriptions/ewd-fd-fd-fdfs-dsfsfds/resourceGroups/Telemetry/providers/Microsoft.Storage/storageAccounts/testapplicationsfstorage\",\"message\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"hierarchy\":\"dsfsd-fds-4d0d-828a-fdss/Corporate-Default/Azure-BU-Standard\"}},{ \"time\": \"2020-11-10T07:25:57.0379585Z\", \"resourceId\": \"/SUBSCRIPTIONS/fds-fsd-fd-fd-fdsf/RESOURCEGROUPS/TELEMETRY/PROVIDERS/MICROSOFT.STORAGE/STORAGEACCOUNTS/TESTAPPLICATIONSFSTORAGE\", \"operationName\": \"MICROSOFT.STORAGE/STORAGEACCOUNTS/LISTKEYS/ACTION\", \"category\": \"Administrative\", \"resultType\": \"Success\", \"resultSignature\": \"Succeeded.OK\", \"durationMs\": \"36\", \"callerIpAddress\": \"4646\", \"correlationId\": \"fsdfsd-a1ca-4a6b-a68d-fdsfd\", \"identity\": {\"authorization\":{\"scope\":\"/subscriptions/fdfs-9c7e-fdsf-fsdf-fdsfs/resourceGroups/Telemetry/providers/Microsoft.Storage/storageAccounts/testapplicationsfstorage\",\"action\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"evidence\":{\"role\":\"Reader and Data Access\",\"roleAssignmentScope\":\"/subscriptions/sfds-fsdfs-sdf-sdf-fsdfs\",\"roleAssignmentId\":\"sfsd\",\"roleDefinitionId\":\"sdfsds\",\"principalId\":\"fsfs\",\"principalType\":\"ServicePrincipal\"}},\"claims\":{\"aud\":\"https://management.azure.com/\",\"iss\":\"https://sts.windows.net/sdf-fsdf-fsdf-sdfd-sfd/\",\"iat\":\"1604990585\",\"nbf\":\"321313\",\"exp\":\"3434\",\"aio\":\"fsd+fsd/fsd==\",\"appid\":\"wsf-5bf3-4772-939f-65ffe84316f0\",\"appidacr\":\"1\",\"http://schemas.microsoft.com/identity/claims/identityprovider\":\"https://sts.windows.net/b9921086-ff77-4d0d-828a-sdf/\",\"http://schemas.microsoft.com/identity/claims/objectidentifier\":\"sfd-fsd-fsd-fsd-fsdf\",\"rh\":\"0.sdfsd-hDFvBYAAA.\",\"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier\":\"02c77a59-5ba2-4b2d-998b-7cf964b4fd3f\",\"http://schemas.microsoft.com/identity/claims/tenantid\":\"sfds-ff77-4d0d-sfd-fsdfs\",\"uti\":\"fsdfs\",\"ver\":\"1.0\",\"xms_tcdt\":\"464\"}}, \"level\": \"Information\", \"properties\": {\"statusCode\":\"OK\",\"serviceRequestId\":\"fdsd-fsdf-fds-887c-sdf\",\"eventCategory\":\"Administrative\",\"entity\":\"/subscriptions/sdfs-fdsf-sdf-fdsfsd-abbc1666f98f/resourceGroups/Telemetry/providers/Microsoft.Storage/storageAccounts/testapplicationsfstorage\",\"message\":\"Microsoft.Storage/storageAccounts/listKeys/action\",\"hierarchy\":\"ss-ss-ss-ss-ss/Corporate-Default/ss-BU-ss\"}}]}"
        }
    }
]

这是valid JSON file

相关问题 更多 >