title: How to return Java.util.ArrayList from a Restful webservice?
body: <p>I need to return a list of objects from a restful webservice. each object is a row of database table data. </p>
  
  <p>This is my restfulwebservice </p>
  
  <pre><code>@GET
  @Consumes("text/html")
  @Produces(MediaType.MULTIPART_FORM_DATA)
  public ArrayList&lt;FetchDatabase&gt; fetchFromDatabse(){
  return new CouponSetup().fetchFromDatabse();
  }
  </code></pre>
  
  <p>FetchDatabase is a bean. I got the required resultset size after the fetch</p>
  
  <p>when i try to call this webservice am getting an error Status 500 Internal server error and the following in the console</p>
  
  <p>A message body writer for Java class java.util.ArrayList, and Java type java.util.Collection, and MIME media type multipart/formdata was not found    </p>
  
  <p>I have tried commenting the @produces annotation still the same error with MIME media type application/octet-stream</p>
  
  <p>I have read that we need to convert the list to XML or json and retrieve it later</p>
  
  <p>Is there any alternate way?If not can u help me parsing the object into XML/JSON and retrieving later in JAVASCRIPT</p>
  
  <p>Can anyone help in a method to iterate through the object here JSONArray and form a table from it
  I am using Tomcat 7.0.22 server and jersey RS 1.11</p>