title: How to convert json to ArrayList object in Java?
body: <p>i want convert json values to ArrayList objects in java...., i have:</p>
  
  <pre><code>{"Products":[
  {
        "id":001,
        "name":"mouse"
      },
      {
        "id":002,
        "name":"Monitor"
      }
  ]}
  </code></pre>
  
  <p>// model</p>
  
  <pre><code>Public class Product {
  
     private int id; 
     private String name;
  
     //getters and setters
  }
  </code></pre>
  
  <p>//
      and 
      method</p>
  
  <pre><code>JSONArray jsonArray= new JSONArray(jsonProducts);
  List&lt;Product&gt; list = new ArrayList&lt;Product&gt;();
  Product p = new Product();
  
  for(int i=0; i&lt;jsonArray.length; i++) {
       product.setId(??);
       product.setName(??);
       list.add(??);
  }
  </code></pre>
  
  <p>I'm using org.json</p>