Groovy 断言包含点的json字段

Groovy 断言包含点的json字段,groovy,soapui,Groovy,Soapui,我有一个json响应,输出以下内容: { "message": "The request is invalid.", "modelState": { "request.xxx": [ "The field xxx must be between xxx and xxx." ], "request.xxx": [ "The field xxx must be between xxx and xxx." ], "request.

我有一个json响应,输出以下内容:

{
  "message": "The request is invalid.",
  "modelState": {
    "request.xxx": [
      "The field xxx must be between xxx and xxx."
    ],
    "request.xxx": [
      "The field xxx must be between xxx and xxx."
    ],
    "request.xxx[0].xxx": [
      "The field xxx must be between xxx and xxx."
    ]
  }
}
现在,通常在脚本断言中,我们会通过输入json的字段名来查找json中的级别。例如,如果我想查找
request.xxxHotelId
,我将转到
def xxxHotelId=json.modelState.request.xxxrHotelId

但正如你所看到的,问题在于。在
请求
xxxHotelID
之间。因为有一个,它会认为
request
xxxHotelID
处于不同的级别,所以它不会在响应中找到此字段

我的问题是如何找到字段
request.xxxHotelId

它与

def juniperhotelid = json.modelState.'request.JuniperHotelId'
这很容易

def juniperhotelid = json.modelState.'request.JuniperHotelId'

您还可以使用映射下标表示法
json.modelState['request.JuniperHotelId']
您还可以使用映射下标表示法
json.modelState['request.JuniperHotelId']