I am very new to reactive programming. I am consuming a webflux API which is returning stream response ( application/stream+json ). My task is to call the API and convert response to List. My code snippet for calling API
ClientResponse res = webClient.method(HttpMethod.GET)
.uri("uri")
.header("Authorization", "Basic " + encoding)
.header("Accept","*/*").exchange().block();
The API response is
{
"name" : "Andrew"
....
}
{
"name" : "Bob"
.....
}
I am trying out few examples like
Flux<String> flux = res.bodyToFlux(String.class);
List<String>> list1 = flux.collectList().block;
But this returns list1 with just a single String of the entire response but my requirement is List of multiple string corresponding to each { } in API response. Can anyone please help here.