import groovy.json.JsonOutput;
def parser = new groovy.json.JsonSlurper();
def jsonResp = parser.parseText(responseBodyTextToClient);
String name= jsonResp.XXX.YYY.Information.Name;
String surname = jsonResp.XXX.YYY.Information.Surname;
if ( name == null || name.isEmpty()) {
statusCodeToClient=503;
def pretty = JsonOutput.prettyPrint(JsonOutput.toJson([name:"", surname:""]))
responseBodyTextToClient=pretty
}
else{
def pretty = JsonOutput.prettyPrint(JsonOutput.toJson([name:name, surname: surname ]))
responseBodyTextToClient=pretty
}
GROOVY