如何检查 SOAP UI 脚本断言中的 json 中是否存在 DTO?

how to check a DTO exists in a json within SOAP UI Script Assertion?

我有一个 json 显示如下:

{
 "rating": "5"
}

我已经断言 'rating' 的值不为空,但我想添加另一个断言 DTO "rating" 存在。如何使用脚本断言完成此操作是 SOAP UI?

import com.eviware.soapui.support.GroovyUtils
import groovy.json.JsonSlurper 
def response = messageExchange.response.responseContent
def json = new JsonSlurper().parseText(response)

def rating = json.rating
assert json.rating != null
assert json.containsKey('rating')

groovy 中 json 对象的 class:

http://docs.groovy-lang.org/2.4.7/html/gapi/groovy/json/internal/LazyMap.html