Forum Discussion
groovyguy
8 years agoCommunity Hero
I believe you were very close, but there's a slightly easier way. Here's an adjustment to your script:
import groovy.json.JsonSlurper
// Get the responses and convert to string
def Response1 = context.expand( '${GetDonorID#Response}' ).toString();
def Response2 = context.expand( '${GetGUID#Response}' ).toString();
log.info(Response1);
log.info(Response2);
// Set up JSON parsers of the two responses
def GetDonorID = new JsonSlurper().parseText(Response1);
def GetGUID = new JsonSlurper().parseText(Response2);
log.info(GetDonorID);
log.info(GetGUID);
// Use JSON to find the guids
log.info (GetDonorID["GUID"]);
log.info(GetGUID["value"]["GUID"]);
// Compare the guids
assert (GetDonorID["GUID"].equals(GetGUID["value"]["GUID"]));