Tag: jsonpath

计数与jsonpath成员?

有没有可能计算使用JsonPath的成员数量? 使用弹簧MVCtesting我正在testing一个控制器,产生 {"foo": "oof", "bar": "rab"} 同 standaloneSetup(new FooController(fooService)).build() .perform(get("/something").accept(MediaType.APPLICATION_JSON)).andExpect(status().isOk()) .andExpect(jsonPath("$.foo").value("oof")) .andExpect(jsonPath("$.bar").value("rab")); 我想确保生成的json中没有其他成员。 希望通过使用jsonPath来对它们进行计数。 可能吗? 备用解决scheme也是受欢迎的。