I'm trying create a function in which I pass a json object from JsonSlurper
and a string which contains json object located in the original. If it does, it returns true or false if the elements count condition is satisfied. For example:
myJson:
{
"Errors": [],
"Loans": [
{
"Applications": [
{
"id": 1,
"name": "test"
}
]
},
{
"Applications": [
{
"id": 2,
"name": "test3"
},
{
"id": 3,
"name": "test3"
}
]
}
]
}
My method would get the json array as follows:
def myJson = new JsonSlurper().parseText(receivedResponse.responseBodyContent)
def result = verifyElementsCountGreaterThanEqualTo(myJson, "Loans[0].Applications[1]", 3)
Is there such a library that can do this for me?
I've tried myJson["Loans[0].Applications[1]"]
to get the Json Object so I can get the size, but the result is null
.