Forum Discussion
AlexKaras
7 years agoChampion Level 3
Hi,
Yes, this seems to be possible.
Using this reference (https://community.smartbear.com/t5/SoapUI-Open-Source/Extracting-child-node-from-JSON-Response/m-p/154308) I entered the following code in the Script field of default response and got the expected result in the mock response.
import groovy.json.JsonSlurper import groovy.json.JsonOutput def payload = mockRequest.requestContent //log.info(payload.toString()) def json = new JsonSlurper().parseText(payload.toString()) //log.info(json) def myData = [ "company": "company123", "location": "India", "client": "client123", "team": "BIG" ] json << myData //log.info(json.toString()) mockResponse.responseContent = new JsonOutput().toJson(json)
Related Content
- 4 years ago