title: How to convert Mono<String> to Mono<MyObject>?
body: <p>I am writing a simple get method to retrieve reviews from an API URL. The API is returning json data as String. Returning <code>Mono&lt;Object&gt;</code> throws an error. Please find below the HTTP response.</p>
  
  <pre><code>{
      "timestamp": "2019-02-05T11:25:33.510+0000",
      "path": "Some URL",
      "status": 500,
      "error": "Internal Server Error",
      "message": "Content type 'text/plain;charset=utf-8' not supported for bodyType=java.lang.Object"
  }
  </code></pre>
  
  <p>I found that the response is a string. So returning <code>Mono&lt;String&gt;</code> is working fine. But I want to return <code>Mono&lt;MyObject&gt;</code> from the API response.</p>
  
  <p>How do I convert <code>Mono&lt;String&gt;</code> to <code>Mono&lt;MyObject&gt;</code>? I could not find any solutions on google except <a href="https://stackoverflow.com/questions/47179937/how-to-get-string-from-monostring-in-reactive-java">How to get String from Mono&lt;String&gt; in reactive java</a>.</p>
  
  <p>Below is my service class:</p>
  
  <pre><code>@Service
  public class DealerRaterService {
      WebClient client = WebClient.create();
      String reviewBaseUrl = "Some URL";
  
      public Mono&lt;Object&gt; getReviews(String pageId, String accessToken) {
          String reviewUrl = reviewBaseUrl + pageId + "?accessToken=" + accessToken;
          return client.get().uri(reviewUrl).retrieve().bodyToMono(Object.class);
      }
  }
  </code></pre>
  
  <p>Edit: Adding my controller class:</p>
  
  <pre><code>@RestController
  @RequestMapping("/path1")
  public class DealerRaterController {
  
      @Autowired
      DealerRaterService service;
  
      @RequestMapping("/path2")
      public Mono&lt;Object&gt; fetchReview(@RequestParam("pageid") String pageId,
              @RequestParam("accesstoken") String accessToken) throws ParseException {
          return service.getReviews(pageId, accessToken);
      }
  }
  </code></pre>
  
  <p>Let me know you need any more information.</p>