i tried to read the content of the json with jsonPath and i get an error.
Here the junit test method:
mockMvc.perform(get("/path")
.andExpect(status().isOk())
.andExpect(jsonPath("$.id", is(1)))
.andExpect(jsonPath("$.name", is("NAME")))
.andReturn().getResponse().getContentAsString();
here is what the request return me:
[{"id":1,"name":"NAME","....}, ....}]
i got this error:
No value for JSON path: $.id, exception: Path 'id' is being applied to an array. Arrays can not have attributes.
can someone helps me.
Thanks