title: RestEasy - Jax-rs - Sending custom Object in response body
body: <p>How do I send my custom object in a response. I just want the values printed from my object.</p>
  
  <p>Lets say I have an object of type <code>Person</code>. I am trying to send in REST response body like this.</p>
  
  <pre><code>  ResponseBuilder response = Response.ok().entity(personObj);
    return response.build();
  </code></pre>
  
  <p>But I get <code>500</code> error.
  Tried this one too:</p>
  
  <pre><code>  ResponseBuilder response = Response.status(Status.OK).entity(personObj);
    return response.build();
  </code></pre>
  
  <p>Same error. </p>
  
  <p>Tried setting content type as <code>text/xml</code>. No use.
  What am I missing here? I tried googling. But not many examples out there, especially with the custom objects;</p>
  
  <p>It returns fine, if I just pass a string to <code>entity()</code> method.</p>