title: How to deserialize JSON response from Jersey REST service to collection of java objects
body: <p>I write client that makes GET request to REST service using Jersey Client API.
  Response is a collection of objects, and I need to deserialize it. Here is my code: </p>
  
  <pre><code>    ClientConfig clientConfig = new DefaultClientConfig();
      clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
              Boolean.TRUE);
      Client client = Client.create(clientConfig);
      WebResource r = client
              .resource("http://localhost:8080/rest/gadgets");
  </code></pre>
  
  <p>and class that represents "gadget" model (annotated with  @XmlRootElement for JAXB processing): </p>
  
  <pre><code>    @XmlRootElement
  public class Gadget {
  
      private String url;
      private String title;
      private String name;
  
      public Gadget() {
  }
  
  
  public String getUrl() {
      return url;
  }
  
  public void setUrl(String url) {
      this.url = url;
  }
  
  
  public String getTitle() {
      return title;
  }
  
  public void setTitle(String title) {
      this.title = title;
  }
  
  public String getName() {
      return name;
  }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>If response would just Gadget copy, not a collection, the could looked as </p>
  
  <pre><code>Gadget result = r.get(Gadget.class);
  </code></pre>
  
  <p>But JSON in response contains a list of gadgets, and I need to read it to java collection. Something like </p>
  
  <pre><code>List&lt;Gadget&gt; result = r.get(List&lt;Gadget&gt;.class);
  </code></pre>
  
  <p>doesn't compile. Can somebody help me here? 
  I don't want to use any additional libs, I believe this can be done using jersey-json.jar and JAXB, but don't know how. </p>