title: How to convert ArrayList to JSON object
body: <pre><code>public ArrayList&lt;String&gt; convertJsonToJsonObject(){
  
      ArrayList&lt;String&gt; mylist = new ArrayList&lt;String&gt; ();
  
      mylist.add("abc");
      mylist.add("cfd");
      mylist.add("ert");
      mylist.add("fg");
      mylist.add("ujk");
      mylist.add("wer");
  
      mylist.add("dvb");
      mylist.add("ert");
  
  
      System.out.println("JSONObject :: "+(JSONObject)JSONSerializer.toJson(mylist));
  }
  </code></pre>
  
  <p>I am having error at <code>.toJson()</code> method, I am not sure what is the mistake I am making.</p>