title: Is it better to pass back String or Object in the ResponseEntity<>?
body: <p>I have a controller that returns ResponseEntity. Now I have altered this code and added a bunch of filters using ObjectMapper. After this change I am returning a String as the response.</p>
  
  <p>Sample code below:</p>
  
  <pre><code>public ResponseEntity&lt;String&gt; search() {
  SearchResult searchResults = service.search(criteria);
  objectMapper.setFilterProvider(new SimpleFilterProvider()
                  .addFilter("firstFilter", new FirstFilter())
                  .addFilter("secondFilter",new SecondFilter()));
          return new ResponseEntity&lt;&gt;(objectMapper.writeValueAsString(searchResults), OK);
  }
  </code></pre>
  
  <p>Now my question is, is this a good way of doing it. Does it have any implications. What is the difference between sending the actual Object back as opposed to the String variant of it. Any help appreciated. Thanks!</p>