title: fetch list from json array
body: <p>I have json string,I want to fetch data from that string..</p>
  
  <p><strong>jsonString</strong> data is like</p>
  
  <pre><code>[{"Eid":"1","name":"Rahim"},{"Eid":"2","name":"Karim"}]
  </code></pre>
  
  <p>I have tried below code</p>
  
  <p><strong>Employee class</strong></p>
  
  <pre><code>public class Employee {
      private String Eid;
      private String name;
  //setters and getters
  
  Employee(){};//constructor
  Employee(String Eid,String name){}//constructor
  
  
  }
  </code></pre>
  
  <p><strong>Main class</strong></p>
  
  <pre><code>try{
  
  JSONArray jsonarray = new JSONArray(jsonString);
  
  Gson gson = new Gson();
  
  Employee employee = new Employee();
  
  employee=  gson.fromJson(jsonarray.toString(), Employee.class);
  
  //display every employee details
  logger.info(employee);
  
   }
   catch (Exception e) {
  
  logger.error("Employee save &gt; Error: " + e.getMessage());
  
  }    
  </code></pre>
  
  <p>But getting error: </p>
  
  <pre><code>Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2
  </code></pre>