I have the following JSON Response:
{
\"Count\": 1,
\"Products\": [
{
\"ProductID\": 3423
},
{
\"Prod
after retrieve()
you can always .map
your result to corresponding type. With the help of JsonNode
path()
instance method you can do it similar to WebTestClient
jsonPath()
webClient.get()
.uri(uriBuilder -> uriBuilder
.path(URI_PRODUCTS)
.build())
.accept(MediaType.APPLICATION_JSON)
.retrieve()
.bodyToMono(JsonNode.class)
.map(s-> s.path("Products"))
.map(s->{
try {
return mapper.readValue(s.traverse(), new TypeReference>() {} );
} catch (IOException e) {
e.printStackTrace();
return new ArrayList();
}
})
.block();