title: How to Create JSONArray for a List<Class name>
body: <p>I have a class called</p>
  <pre><code>class Student {
     String name;
     String age;
  }
  </code></pre>
  <p>I have a method that returns List object like</p>
  <pre><code>public List&lt;Student&gt; getList(){
  
   List&lt;Student&gt; li =new ArrayList();
   ....
  
   li.add(new Student('aaa','12'));
   ... 
  
   return li;    
  }
  </code></pre>
  <p>I need to convert that list into JSONArray like this</p>
  <pre><code>[{&quot;name&quot;:&quot;sam&quot;,&quot;age&quot;:&quot;12&quot;},{&quot;name&quot;:&quot;sri&quot;,&quot;age&quot;:&quot;5&quot;}]
  </code></pre>
  <p>Can anyone help me to get this?</p>