title: How to parse JSON array using Jersey Rest Webservices and Java
body: <p>I am getting Json array from iOS client and want to parse the Json in server side using Java and jersey and Gson. I am sending the JSON array in POST method from iOS. I want to consume the json but stuck on how do i save the json data in Java class. This is the structure of my Json array</p>
  
  <pre><code>{
      "friendList": [
        {"id": 1, "username": "user1", "name":"person1", "friendUsername":"fUser1", "friendName":"fName1"},
        {"id": 2, "username": "user2", "name":"person2", "friendUsername":"fUser2", "friendName":"fName2"},
        {"id": 3, "username": "user3", "name":"person3", "friendUsername":"fUser3", "friendName":"fName3"},...
      ]
  }
  </code></pre>
  
  <p>Here is my web services Class</p>
  
  <pre><code>@Path("/FriendsList")
  public class RestWebServicesAPI {
  
  
       @POST
       @Path("/friends")
       @Consumes(MediaType.APPLICATION_JSON)
       public Friends saveFriedList(Friends friend, @Context HttpServletRequest request) {
  
          // Don't know how to parse json array????
  
       }
  
  
  }
  </code></pre>
  
  <p>and Here is my Friends Class</p>
  
  <pre><code>import java.util.List; 
  
  import javax.xml.bind.annotation.XmlRootElement; 
  
  @XmlRootElement 
  
  Public Class Friends {
  
      private String id; 
      private String username; 
      private String name; 
      private String friendUsername; 
      private String friendName;  
  
      public Friends() { 
      } 
  
     //getter setter methods
  
  } 
  </code></pre>