title: Converting large result set to JSON in Java REST Web service
body: <p>I am writing a REST API in java which basically generates a large report from database. The results from result set are passed as JSON to client. I tried converting result set to JSONArray but if result set size is large, I am getting below exception.</p>
  
  <pre><code>java.lang.OutOfMemoryError: GC overhead limit exceeded
  </code></pre>
  
  <p>Is there any efficient way to do this?</p>