title: JSON deserialization using GSON
body: <p>I have the following json response from a url:</p>
  
  <pre><code>stdClass Object
  (
      [uname] =&gt; Eamorr
      [phoneNumber] =&gt; 082732938293
      [fname] =&gt; Steve
      [lname] =&gt; Hearst
      [sex] =&gt; M
      [roofSignNumber] =&gt; 230948
      [vehicleReg] =&gt; 07D2892
      [vehicleMake] =&gt; Toyota
      [vehicleModel] =&gt; Avensis
      [vehicleNumPassengers] =&gt; 4
      [profilePic] =&gt; -1
      [online] =&gt; 1
      [status] =&gt; 
      [picList] =&gt; Array
          (
          )
  
      [lat] =&gt; 
      [lng] =&gt; 
      [reputation] =&gt; 0.63
      [numPagesComments] =&gt; 1
      [last5comments] =&gt; Array
          (
              [0] =&gt; stdClass Object
                  (
                      [comment] =&gt; hello5
                      [fromUname] =&gt; Eamorr
                      [profilePic] =&gt; -1
                      [time] =&gt; 1290254763
                      [id] =&gt; 23628mr28018onm647z2
                  )
  
          )
  
  )
  </code></pre>
  
  <p>And here's how I'm doing the parse:</p>
  
  <pre><code>                      Gson json=new Gson();
                        try{
                            Driver driver=json.fromJson(response,Driver.class);
                            Log.i("json",driver.profilePic);
                        }catch(JsonParseException e){
                            Log.i("error","JsonParseException");
                        }
  </code></pre>
  
  <p>When I run the code, I get this error:
  ERROR/AndroidRuntime(823): java.lang.RuntimeException: No-args constructor for class com.project.driver.Driver$Post does not exist. Register an InstanceCreator with Gson for this type to fix this problem.</p>
  
  <p>I'm having trouble with defining a suitable Driver.java for the parse. When I omit the 'last5comments' field, everything works fine, it's just the 'last5comments' bit I'm having trouble with...</p>
  
  <p>Here is Driver.java:</p>
  
  <pre><code>public class Driver {
      public String uname="";
      public String phoneNumber="";
      public String fname="";
      public String lname="";
      public String sex="";
      public String roofSignNumber="";
      public String vehicleReg="";
      public String vehicleMake="";
      public String vehicleModel="";
      public String vehicleNumPassengers="";
      public String profilePic="";
      public String online="";
      public String status="";
      public String[] picList;
      public String lat="";
      public String lng="";
      public String reputation="";
      public String numPagesComments="";
  
      //having problems below this line 
      public Post[] last5comments;
  
      public class Post{
          public String comment="";
          public String fromUname="";
          public String profilePic="";
          public String time="";
          public String id="";
      }
  }
  </code></pre>
  
  <p>Any help with defining a suitable Driver.java is much appreciated.</p>
  
  <p>Thanks in advance,</p>