I have an application that can compare JSON response from multiple deployments written in Groovy (Based on JDK8). The purpose was like to compare JSON response that I'm getting from multiple servers. For now, the response that I'm getting is not in sort order. So, though both the response are same valued due to unorder they are not comparable. If there is an algorithm to soft any multi-level JSON response to sort them by their level wise key then their corresponding value, My issue may be resolved. There is also some key that needs to be ignored like timestamp response. Usually, I ignore that from my comparison by a different logic.
Please, feel free to ask me any further queries you have relevant to my question.
Feedback:
Sample1:
{
"Products": [{
"Product": {
"productId": "91e61245",
"productName": "prod_name3",
"productNo": "100000319714"
}
},
{
"Product": {
"productId": "a3e82487",
"productName": "prod_name2",
"productNo": "100000319701"
}
},
{
"Product": {
"productId": "75f80523",
"productName": "prod_name1",
"productNo": "100000319707"
}
}
]
}
Sample2:
{
"Products": [
{
"Product": {
"productId": "75f80523",
"productName": "prod_name1",
"productNo": "100000319707"
}
},
{
"Product": {
"productId": "91e61245",
"productName": "prod_name3",
"productNo": "100000319714"
}
},
{
"Product": {
"productId": "a3e82487",
"productName": "prod_name2",
"productNo": "100000319701"
}
}
]
}
Here both of the response is in a sense identical, but unfortunately, they are not for my case. Sample 2 is unordered and Sample 1 is ordered. If both response I made an order first they would be identical. For my investigation, I use the following site for JSON sort.
If you have any other suggestion for the similar payload comparison test on multiple server in parallel, please let me know.