title: ArrayList<Object> JSON
body: <p>I am trying to return JSON data with my restlet.
  I can return a single item's JSON with..</p>
  
  <pre><code>import org.json.JSONObject;
  
  Site aSite = new Site().getSite();   
  JSONObject aSiteJson = new JSONObject(aSite);
  return aSiteJson.toString();
  </code></pre>
  
  <p>Returns: {"name":"qwerty","url":"www.qwerty.com"}</p>
  
  <p>How do i return JSON for ArrayList Object</p>
  
  <pre><code>ArrayList&lt;Site&gt; allSites = new SitesCollection().getAllSites();   
  JSONObject allSitesJson = new JSONObject(allSites);
  return allSitesJson.toString();
  </code></pre>
  
  <p>Returns: {"empty":false}</p>
  
  <pre><code>ArrayList&lt;Site&gt; allSites = new SitesCollection().getAllSites();   
  JSONArray allSitesJson = new JSONArray(allSites);
  return allSitesJson.toString();
  </code></pre>
  
  <p>Returns: ["com.sample.Site@4a7140","com.sample.Site@1512c2e","com.sample.Site@2bba21","com.sample.Site@c8d0b7"]</p>
  
  <p>Here is my Site class</p>
  
  <pre><code>public class Site {
  private String name;
  private String url;
  
  public String getName() {
      return name;
  }
  public void setName(String name) {
      this.name = name;
  }
  public String getUrl() {
      return url;
  }
  public void setUrl(String url) {
      this.url = url;
  }
  
  public Site(String name, String url) {
      super();
      this.name = name;
      this.url = url;
  }       
  
  }
  </code></pre>
  
  <p>Thanks</p>