[
{
"fieldName": "fieldOne",
"normalJson": "{\"nameRawText\":\"Man\",\"addressRawText\":\"23 Third \",\"cityRawText\":\"LONDON\",\"stateRawText\":null,\"countryRawText\":\"United Kingdom\",\"rawText\":\"Man 23 Third, LONDON United Kingdom\"}",
"documentName": "documentOne"
},
{
"fieldName": "fieldTwo",
"normalJson": "{\"nameRawText\":\"Man\",\"addressRawText\":\"23 Third SE55\",\"cityRawText\":\"LONDON\",\"stateRawText\":null,\"countryRawText\":\"United Kingdom\",\"rawText\":\"Man 23 Third, LONDON United Kingdom\"}",
"documentName": "documentOne"
},
{
"fieldName": "fieldThree",
"normalJson": "{\"nameRawText\":\"Mick\",\"addressRawText\":null,\"cityRawText\":null,\"stateRawText\":null,\"countryRawText\":\"India\",\"rawText\":\"Mick India\"}",
"documentName": "documentOne"
},
{
"fieldName": "fieldSix",
"normalJson": "{\"nameRawText\":\"Mick\",\"addressRawText\":null,\"cityRawText\":null,\"stateRawText\":null,\"countryRawText\":\"India\",\"rawText\":\"Mick India\"}",
"documentName": "documentOne"
},
{
"fieldName": "fieldOne",
"normalJson": "{\"nameRawText\":\"Man\",\"addressRawText\":\"23 Third \",\"cityRawText\":\"LONDON\",\"stateRawText\":null,\"countryRawText\":\"United Kingdom\",\"rawText\":\"Man 23 Third, LONDON United Kingdom\"}",
"documentName": "documentTwo"
},
{
"fieldName": "fieldFour",
"normalJson": "{\"nameRawText\":\"Man\",\"addressRawText\":\"23 Third \",\"cityRawText\":\"LONDON\",\"stateRawText\":null,\"countryRawText\":\"United Kingdom\",\"rawText\":\"Man 23 Third, LONDON United Kingdom\"}",
"documentName": "documentTwo"
},
]
Expected output:
[
{
"nameRawText" : "Man"
"fieldName" : "fieldOne,fieldTwo,fieldFour"
"documentName" : documentOne,documentTwo"
"nameRawText" : "Mick"
"fieldName" : "fieldThree,fieldSix"
"documentName" : "documentOne"
}
]
Test Scenario:
Find duplicate values of (nameRawText, cityRawText or countryRawText) inside "normalJson" and print duplicate values along with the respective keys (nameRawText, cityRawText or countryRawText) + "fieldName" + "documentName".
Query:
Please provide suggestions to handle the above mentioned scenario dynamically.
Please note the following points:
- Payload is dynamic with various number of documents and fields.
- We tried (karate.filter, karate.jsonPath, Hashmap) and did not receive expected output
- karate.distinct method is not supported in my IDE.