我正在尝试使用Jsonpath验证以下json。我无法在“ fieldMap”之后验证任何值。我尝试的所有内容都没有JSON路径错误。请提供有关如何验证json字符串的建议。
{
"Identifier": "ABC#SOMEYNC001#112#2018071900:00",
"someEventId": "Some001",
"Error": null,
"fieldMap": {
"responseKey [someType=APPLICANT, somebaseid=982465, somechildid=Some001]": {
"Gur.CalledFlag": "Y",
"Some.SomeField01": "null",
"Some.SomeField02": "null",
"Some.SomeField03": "null",
"Some.SomeField04": "null",
},
"responseKey [someType=APPLICANT, somebaseid=982455, somechildid=Some001]": {
"Gur.CalledFlag": "Y",
"Some.SomeField01": "null",
"Some.SomeField02": "null",
"Some.SomeField03": "null",
"Some.SomeField04": "null",
}
},
"someMap": {
"982465": {
"urlMap": "http://someurl.com"
},
"982455": {
"urlMap": "http://someurl.com"
}
}
}
这就是我尝试验证失败的方法。
this.mockMvc
.perform(get("/v1.0/someapi/ABC/{SomeEventId}",
"Some001",
.andExpect(status().isOk())
.andExpect(jsonPath("$.Identifier").value(notNullValue()))
.andExpect(jsonPath("$.someEventId").value("Some001")))
//.andDo(MockMvcResultHandlers.print())
.andExpect(jsonPath("Error").value(nullValue()));
//.andExpect(jsonPath("$.fieldMap").value(nullValue()))
//.andExpect(jsonPath("$..[Gur.CalledFlag]").value(nullValue()));
我是新手,非常感谢您的帮助!