title: How to parse a Spring 5 WebClient response in a non-blocking way?
body: <p>I'm using Spring WebFlux WebClient to retrieve data from an external API, like this:</p>
  
  <pre><code>public WeatherWebClient() {
      this.weatherWebClient = WebClient.create("http://api.openweathermap.org/data/2.5/weather");
  }
  
  public Mono&lt;String&gt; getWeatherByCityName(String cityName) {
      return weatherWebClient
              .get()
              .uri(uriBuilder -&gt; uriBuilder
                                  .queryParam("q", cityName)
                                  .queryParam("units", "metric")
                                  .queryParam("appid", API_KEY)
                                  .build())
              .accept(MediaType.APPLICATION_JSON)
              .retrieve()
              .bodyToMono(String.class);
  }
  </code></pre>
  
  <p>This works fine and produces a response like this:</p>
  
  <pre><code>{
      "coord":{
          "lon":-47.06,
          "lat":-22.91
      },
      "weather":[
      {
          "id":800,
          "main":"Clear",
          "description":"clear sky",
          "icon":"01d"
      }
      ],
      "base":"stations",
      "main":{
          "temp":16,
          "pressure":1020,
          "humidity":67,
          "temp_min":16,
          "temp_max":16
      },
      "visibility":10000,
      "wind":{
          "speed":1,
          "deg":90
      },
      "clouds":{
          "all":0
      },
      "dt":1527937200,
      "sys":{
          "type":1,
          "id":4521,
          "message":0.0038,
          "country":"BR",
          "sunrise":1527932532,
          "sunset":1527971422
      },
      "id":3467865,
      "name":"Campinas",
      "cod":200
  }
  </code></pre>
  
  <p>But I'm only interested in the <strong>"temp"</strong> property (main -> temp). How could I transform the response (using Jackson's ObjectMapper, for example) to return only <strong>"temp"</strong> value in a reactive/non-blocking way?</p>
  
  <p>I understand the first thing is replacing ".retrieve()" by ".exchange()" but I can't figure out how to make it work.</p>
  
  <p><em>PS: This is my first question here. Please let me know if I'm doing something wrong or if you need more details.</em></p>
  
  <p>Thanks!</p>