In the above script file, getResponseText() method spits out below reponse,
how do I extract the value for parameter, lets say “authenticationToken”, “displayName” etc…
The extracted data from the response in your case is in JSON format, so we could get the value of each key “authenticationToken”, “displayName” and “smartNumber”. Here is an example of geting the value out:
import groovy.json.JsonSlurper class Example { static void main(String[] args) { def jsonSlurper = new JsonSlurper() def object = jsonSlurper.parseText('{ "name": "John", "ID" : "1"}') println(object.name); println(object.ID); } }
Many thanks above groovy code works like a charm,
however I’ve chose to use Katalon because it supports java, I’ve never worked on Groovy before.
Therefore could you may be point me to a way to achieve this through java way please