I am testing RESTful webservice using SoapUI. We use Groovy for that. I am using jsonslurper to parse the response as Object type.
Our reponse is similar to this:
{
"language":[
{
"result":"PASS",
"name":"ENGLISH",
"fromAndToDate":null
},
{
"result":"FAIL",
"name":"MATHS",
"fromAndToDate": {
"from":"02/09/2016",
"end":"02/09/2016"
}
},
{
"result":"PASS",
"name":"PHYSICS",
"fromAndToDate":null
}
]
}
After this, I stuck up on how to.
- Get Array (because this is array (starts with -
language
) - How to get value from this each array cell by passing the key (I should get the value of
result
key, ifname='MATHS'
only.)
I could do it using Java, but as just now learning Groovy I could not understand this. We have different keys with same names.