I have a request which produces below response:
{
\"totalRows\": 10,
\"colDefs\": [
{
\"entityAttributeId\": \"somestring\",
\"headerName
Please refer to this example that even involves a case-insensitive sort. It is easy to dive into Java from Karate, especially for a complex use-case like this:
Scenario: case-insensitive sort
* def ArrayList = Java.type('java.util.ArrayList')
* def Collections = Java.type('java.util.Collections')
* def json = [{ v: 'C' }, { v: 'b' }, { v: 'A' }]
* def actual = $json[*].v
* match actual == ['C', 'b', 'A']
* def list = new ArrayList()
* eval for (var i = 0; i < actual.length; i++) list.add(actual[i])
* match list == ['C', 'b', 'A']
* eval Collections.sort(list, java.lang.String.CASE_INSENSITIVE_ORDER)
* match list == ['A', 'b', 'C']
Since your example is too complex, I can't provide a specific answer, kindly refer: https://stackoverflow.com/help/mcve
For a cleaner way to express the above code, refer the actual example, where you can move some of the code into JS: https://github.com/intuit/karate/blob/master/karate-junit4/src/test/java/com/intuit/karate/junit4/demos/sort-array.feature