Hi,
Your question is quite generic. Nevertheless here is a simple Json parsing example.
Let's say we have a request called GetResponse for which the response is as follows:
{
"fruits" :
[
"bananas",
"jabu-ticaba",
{
"apples" : [ "red", "green" ]
},
{
"oranges" :
[
{ "clementines" : "red-clementines" },
{ "mandarines" : "small-mandarines" }
]
}
]
}
In order to parse the json response and select some elements in it the following groovy script can be used:
import groovy.json.JsonSlurper
// Get the response from the GetResponse step
def response = context.expand('${GetResponse#Response}')
// Parse the response with JsonSlurper
def jsonSlurper = new JsonSlurper()
def jsonObject = jsonSlurper.parseText( response )
// Get an element from the json object
log.info jsonObject.fruits[2].apples
Here is the full example: https://github.com/lucadln/soapui/tree/master/SoapUIOS/JsonParserExample