Jersey RestAPI Json conversion
<p>I have built a Jersey Rest API producing the JSON response.
Response looks like below:</p>

<pre><code>{
  "errorOccured": "false",
  "transaction": [
    {
      "businessDate": "10/25/2011",
      "canViewReceipt": "false",
      "modifiedBusinessDate": ""
    }
  ]
}
</code></pre>

<p>Jersey Resource response generation is done like below.</p>

<pre><code>Response.ok(myObject).build();
</code></pre>

<p>The problem here is "errorOccured" field has been marked boolean in the backing XSD but during conversion its getting generated as String.</p>

<p>This breaks the consuming JavaScript which checks for errors:</p>

<pre><code>if(json.errorOccured) {
          //do something
}
</code></pre>

<p>Any idea how this can be generated as booleans:</p>

<pre><code>{
  "errorOccured": false,
  "transaction": [
    {
      "businessDate": "10/25/2011",
      "canViewReceipt": false,
      "modifiedBusinessDate": ""
    }
  ]
}
</code></pre>