I have a sampler 1 which generates response like
{ ....... updatedAt: dateAndtime, createdAt: datetime}
Now this response i have to process by removing updatedAt , createdAt key, values and then feed same as request body to next sampler. Could any one help , how to do this?
Add JSR223 PostProcessor as a child of the request which returns the above JSON
Put the following code into "Script" area:
def response = new groovy.json.JsonSlurper().parse(prev.getResponseData())
response.remove('updatedAt')
response.remove('createdAt')
vars.put('request', new groovy.json.JsonBuilder(response).toPrettyString())
Refer the amended request value as ${request}
later on where required
More information: