title: Need RESTLET + JAX-RS + JSON Good example
body: <p>I'm experimenting the Restlet framework with AppEngine and I try to retrieve a list of Object (ArrayList for instance) to a JSON representation with JAX-rs Resource</p>
  
  <p>For instance a sample User class:</p>
  
  <pre><code> public class User {
  
      private String lastname;
  
      private String firstname;
  
      public User(){};
      public User(String lname,String fname){
          this.firstname = fname;
          this.lastname = lname;
      }
  
      public String getLastname() {
          return lastname;
      }
      public void setLastname(String lastname) {
          this.lastname = lastname;
      }
  
      public String getFirstname() {
          return firstname;
      }
      public void setFirstname(String firstname) {
          this.firstname = firstname;
      }
   }
  </code></pre>
  
  <p>I want to retrieve a list of User like this</p>
  
  <pre><code>@GET @Path("users")
  @Produces(MediaType.APPLICATION_JSON)
  public ArrayList&lt;User&gt; getUsers() {     
      ArrayList&lt;User&gt; users = new ArrayList&lt;User&gt;();
      users.add(new User("userlastname1", "userfirstname1"));
      users.add(new User("userlastname3", "userfirstname2"));
  
      return users;
  }
  </code></pre>
  
  <p>and I want to get this JSON representation</p>
  
  <pre><code>[
      {
          lastname: "userlastname1",
          firstname: "userfirstname1"
      },
      {
          lastname: "userlastname2",
          firstname: "userfirstname2"
      }
  ]
  </code></pre>
  
  <p>What is the best way to achieve this? </p>
  
  <p>The Restlet documentation mentioned the serialization proccess is automated, yes it's the case for only one Object like "User"</p>
  
  <pre><code>new User("userlastname1", "userfirstname1")
  </code></pre>
  
  <p>return me the good JSON representation</p>
  
  <pre><code>{
      lastname: "userlastname1",
      firstname: "userfirstname1" 
  }
  </code></pre>
  
  <p>If some one can give me some explanation/sample code/idea about that. much appreciated</p>
  
  <p>Best regards</p>