title: Spring Boot: Return a empty JSON instead of empty body when returned object is null
body: <p>I have a RestController and when I call the method:</p>
  
  <pre><code>@RequestMapping(value = "/sigla/{sigla}")
  @ResponseBody
  public PaisDTO obterPorSigla(@PathVariable String sigla) {
      return service.obterPorSigla(sigla);
  }
  </code></pre>
  
  <p>If a record is found, I get a good JSON response:</p>
  
  <pre><code>{"nome":"Brasil","sigla":"BR","quantidadeEstados":27}
  </code></pre>
  
  <p>but when nothing is found on database the RestController returns null and I get a empty response, completely blank body. </p>
  
  <p>How can I display a empty JSON instead of a blank response? Like bellow:</p>
  
  <pre><code>{}
  </code></pre>
  
  <p>Complete Controller:</p>
  
  <pre><code>@RestController
  @RequestMapping("/pais")
  public class PaisController {
  
      @Autowired
      private PaisService service;
  
      @RequestMapping
      public ResponseEntity&lt;List&lt;PaisDTO&gt;&gt; obterTodos() {
          return CreateResponseEntity.getResponseEntity(service.obterTodos());
      }
  
      @RequestMapping(value = "/sigla/{sigla}", method = RequestMethod.GET, consumes="application/json", produces="application/json")
      public ResponseEntity&lt;PaisDTO&gt; obterPorSigla(@PathVariable String sigla) {
          HttpHeaders headers = new HttpHeaders();
          headers.add("Content-Type", "application/json");
          PaisDTO paisDTO = service.obterPorSigla(sigla);
          if(paisDTO != null) return new ResponseEntity&lt;PaisDTO&gt;(paisDTO, headers, HttpStatus.OK);
          else return new ResponseEntity&lt;PaisDTO&gt;(headers, HttpStatus.OK);
      }
  </code></pre>