Thank you for illustrating the use case clearly with sample data, logic, and expected result from sample. But you also want to specify if Json1 and json2 are in the same row/event. Here is a solution if they are. | table Json1 json2
| transpose 0 column_name=name
| spath input="row 1"
| fields - "row 1"
| foreach *{}
[eval <<MATCHSTR>>_array = mv_to_json_array('<<FIELD>>')]
| fillnull value=null
| fields - *{}
| stats list(*) as *
| foreach *
[eval "<<FIELD>>" = if(mvcount(mvdedup('<<FIELD>>')) < 2, null(), '<<FIELD>>')]
| transpose 0 column_name=KeyName
| search "row 1" = *
| eval KeyName = if(KeyName LIKE "%_array", replace(KeyName, "_array$", "{}"), KeyName)
| eval "Old Value" = mvindex('row 1', 0), "New Value" = mvindex('row 1', 1)
| fields - "row 1"
| foreach *Value
[eval <<FIELD>> = if('<<FIELD>>' != "null", '<<FIELD>>',
if(KeyName LIKE "%{}", "[]", null()))] Here is an emulation you can play with and compare with real data. | makeresults
| fields - _time
| eval Json1 = "{
\"id\": \"XXXXX\",
\"displayName\": \"ANY DISPLAY NAME\",
\"createdDateTime\": \"2021-10-05T07:01:58.275401+00:00\",
\"modifiedDateTime\": \"2025-02-05T10:30:40.0351794+00:00\",
\"state\": \"enabled\",
\"conditions\": {
\"applications\": {
\"includeApplications\": [
\"YYYYY\"
],
\"excludeApplications\": [],
\"includeUserActions\": [],
\"includeAuthenticationContextClassReferences\": [],
\"applicationFilter\": null
},
\"users\": {
\"includeUsers\": [],
\"excludeUsers\": [],
\"includeGroups\": [
\"USERGROUP1\",
\"USERGROUP2\"
],
\"excludeGroups\": [],
\"includeRoles\": [],
\"excludeRoles\": []
},
\"userRiskLevels\": [],
\"signInRiskLevels\": [],
\"clientAppTypes\": [
\"all\"
],
\"servicePrincipalRiskLevels\": []
},
\"grantControls\": {
\"operator\": \"OR\",
\"builtInControls\": [
\"mfa\"
],
\"customAuthenticationFactors\": [],
\"termsOfUse\": []
},
\"sessionControls\": {
\"cloudAppSecurity\": {
\"cloudAppSecurityType\": \"monitor\",
\"isEnabled\": true
},
\"signInFrequency\": {
\"value\": 1,
\"type\": \"hours\",
\"authenticationType\": \"primaryAndSecondaryAuthentication\",
\"frequencyInterval\": \"timeBased\",
\"isEnabled\": true
}
}
}",
json2 = "{
\"id\": \"XXXXX\",
\"displayName\": \"ANY DISPLAY NAME 1\",
\"createdDateTime\": \"2021-10-05T07:01:58.275401+00:00\",
\"modifiedDateTime\": \"2025-02-06T10:30:40.0351794+00:00\",
\"state\": \"enabled\",
\"conditions\": {
\"applications\": {
\"includeApplications\": [
\"YYYYY\"
],
\"excludeApplications\": [],
\"includeUserActions\": [],
\"includeAuthenticationContextClassReferences\": [],
\"applicationFilter\": null
},
\"users\": {
\"includeUsers\": [],
\"excludeUsers\": [],
\"includeGroups\": [
\"USERGROUP1\",
\"USERGROUP2\",
\"USERGROUP3\"
],
\"excludeGroups\": [
\"USERGROUP4\"
],
\"includeRoles\": [],
\"excludeRoles\": []
},
\"userRiskLevels\": [],
\"signInRiskLevels\": [],
\"clientAppTypes\": [
\"all\"
],
\"servicePrincipalRiskLevels\": []
},
\"grantControls\": {
\"operator\": \"OR\",
\"builtInControls\": [
\"mfa\"
],
\"customAuthenticationFactors\": [],
\"termsOfUse\": []
},
\"sessionControls\": {
\"cloudAppSecurity\": {
\"cloudAppSecurityType\": \"block\",
\"isEnabled\": true
},
\"signInFrequency\": {
\"value\": 2,
\"type\": \"hours\",
\"authenticationType\": \"primaryAndSecondaryAuthentication\",
\"frequencyInterval\": \"timeBased\",
\"isEnabled\": true
}
}
}"
``` data emulation above ``` The above search gives KeyName New Value Old Value conditions.users.excludeGroups{} ["USERGROUP4"] [] conditions.users.includeGroups{} ["USERGROUP1","USERGROUP2","USERGROUP3"] ["USERGROUP1","USERGROUP2"] displayName ANY DISPLAY NAME 1 ANY DISPLAY NAME modifiedDateTime 2025-02-06T10:30:40.0351794+00:00 2025-02-05T10:30:40.0351794+00:00 name json2 Json1 sessionControls.cloudAppSecurity.cloudAppSecurityType block monitor sessionControls.signInFrequency.value 2 1 For the life of me I cannot figure where does ModifiedDateTime differ. They look identical to me. We can go more semantic with SPL but as you want the {} notation intact, this is perhaps the most direct.
... View more