This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/tutorials/verify-api-responses.html
This is a companion discussion topic for the original entry at https://docs.katalon.com/katalon-studio/tutorials/verify-api-responses.html
How would I check for the existence of an element in a JSON response – but not care about the value…?
I do
import groovy.json.JsonSlurper as JsonSlurper
def jsonSlurper = new JsonSlurper()
def json = jsonSlurper.parseText(response.getResponseBodyContent())
WS.verifyNotEqual(json.field, null)
Maybe there is shorter, but this construction works for a lot of other situations too