title: Gson : Unable to invoke no-args constructor for class
body: <p>Although there are several threads on this topic.. please do not mark this as duplicate. </p>
  
  <p>My pojo looks like this : </p>
  
  <pre><code>public class sample {
  
  
      public sample() {
          // TODO Auto-generated constructor stub
      }
  
      private String instructions;
      private String resource;
      private List&lt;Map&lt;String,String&gt;&gt; fields;
      private String taskid;
  
      private List&lt;Map&lt;String,String&gt;&gt; answer;
  
      public String getTaskid() {
          return taskid;
      }
      public void setTaskid(String taskid) {
          this.taskid = taskid;
      }
      public String getInstructions() {
          return instructions;
      }
      public void setInstructions(String instructions) {
          this.instructions = instructions;
      }
      public String getResource() {
          return resource;
      }
      public void setResource(String resource) {
          this.resource = resource;
      }
      public List&lt;Map&lt;String,String&gt;&gt; getFields() {
          return fields;
      }
      public void setFields(List&lt;Map&lt;String,String&gt;&gt; fields) {
          this.fields = fields;
      }
      public List&lt;Map&lt;String,String&gt;&gt; getAnswer() {
          return answer;
      }
      public void setAnswer(List&lt;Map&lt;String,String&gt;&gt; answer) {
          this.answer = answer;
      }
  
  
  
  }
  </code></pre>
  
  <p>I am doing a httpget and the result is an array of Json objects I try to typecast it to sample but it gives an exception. </p>
  
  <p>the deserialization snippet is  as follows</p>
  
  <pre><code>sample[] temp = gsonObj.fromJson(response, sample[].class);
  </code></pre>
  
  <p>the exception i get is </p>
  
  <pre><code>java.lang.RuntimeException: Unable to invoke no-args constructor for class [sample;. Register an InstanceCreator with Gson for this type may fix this problem.
      at com.google.gson.MappedObjectConstructor.constructWithAllocators(MappedObjectConstructor.java:68)
      at com.google.gson.MappedObjectConstructor.construct(MappedObjectConstructor.java:52)
      at com.google.gson.JsonObjectDeserializationVisitor.constructTarget(JsonObjectDeserializationVisitor.java:42)
      at com.google.gson.JsonDeserializationVisitor.getTarget(JsonDeserializationVisitor.java:60)
      at com.google.gson.ObjectNavigator.accept(ObjectNavigator.java:104)
      at com.google.gson.JsonDeserializationContextDefault.fromJsonObject(JsonDeserializationContextDefault.java:76)
      at com.google.gson.JsonDeserializationContextDefault.deserialize(JsonDeserializationContextDefault.java:54)
      at com.google.gson.Gson.fromJson(Gson.java:551)
      at com.google.gson.Gson.fromJson(Gson.java:498)
      at com.google.gson.Gson.fromJson(Gson.java:467)
      at com.google.gson.Gson.fromJson(Gson.java:417)
      at com.google.gson.Gson.fromJson(Gson.java:389)
      at HTTPClientUtils.getResultsFromMobileWorks(HTTPClientUtils.java:327)
  </code></pre>
  
  <p>Can you please let me know where i am making the mistake ?? </p>