title: Return Jersey exceptions in JSON
body: <p>What is the best way to return Jersey exceptions in JSON format?
  Here my sample code.</p>
  
  <pre><code>    public static class CompoThngExceptionMapper implements ExceptionMapper&lt;Exception&gt; {
      @Override
      public Response toResponse(Exception exception) {
          if (exception instanceof WebApplicationException) {
              WebApplicationException e = (WebApplicationException) exception;
              Response r = e.getResponse();
              return Response.status(r.getStatus()).entity(**HERE JSON**).build();
      } else {
              return null;
  
          }
      }
  </code></pre>
  
  <p>Thanks in advance!!!</p>