title: Gson issue:- Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1
body: <p>I am bit new to Gson, I have a json in following format:-</p>
  
  <pre><code>{
    "schedulerName" : "Commodities-ETP_Trade_Entry-FO_TCP_OAS_ALSWP-COM_SLS_BZ",  
    "startRequestDate" : "29-06-2017 23:39:54.910",  
    "activeTestCasesCount" : 7,  
    "statusMap" : {    "Assigned" : 2,    "In execution" : 1,    "Pending" : 4  },  
    "subTaskCount" : 12,  
    "subTasks" : [ 
  {    "testCaseName" : "OAS-TCP-ALSWP-0035",    "testCaseType" : "DealEntry",    "activeTestCase" : false,    "statuses" : [ "Excluded" ],  "currentStatus" : "Excluded",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0036",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending", "Assigned", "In execution" ],    "currentStatus" : "In execution",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0037",    "testCaseType" : "DealEntry",    "activeTestCase" : false,    "statuses" : [ "Excluded" ],    "currentStatus" : "Excluded",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0039",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending", "Assigned" ],    "currentStatus" : "Assigned",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0074",    "testCaseType" : "DealEntry",    "activeTestCase" : false,    "statuses" : [ "Excluded" ],    "currentStatus" : "Excluded",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0111",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending" ],    "currentStatus" : "Pending",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0113",    "testCaseType" : "DealEntry",    "activeTestCase" : false,    "statuses" : [ "Excluded" ],    "currentStatus" : "Excluded",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0148",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending" ],    "currentStatus" : "Pending",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0185",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending" ],    "currentStatus" : "Pending",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0222",    "testCaseType" : "DealEntry",    "activeTestCase" : false,    "statuses" : [ "Excluded" ],    "currentStatus" : "Excluded",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0259",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending" ],    "currentStatus" : "Pending",    "message" : ""  }, 
  {    "testCaseName" : "OAS-TCP-ALSWP-0296",    "testCaseType" : "DealEntry",    "activeTestCase" : true,    "statuses" : [ "Pending", "Assigned" ],    "currentStatus" : "Assigned",    "message" : ""  } 
  ],  
  "schedulerStatus" : "In execution",  
  "lastStatusDate" : "29-06-2017 23:40:19.251"}
  </code></pre>
  
  <p>and have an java class:-
  package com.nab.testing.taf.config;</p>
  
  <pre><code>import java.util.List;
  
  /**
   *
   * Created by vpathani on 30/06/2017.
   */
  public class SmtStatus {
  
      public class SubTasks {
          private String testCaseName;
          private String testCaseType;
          private boolean activeTestCase;
          private String currentStatus;
  
          public String getTestCaseName() {
              return testCaseName;
          }
  
          public void setTestCaseName(String testCaseName) {
              this.testCaseName = testCaseName;
          }
  
          public String getTestCaseType() {
              return testCaseType;
          }
  
          public void setTestCaseType(String testCaseType) {
              this.testCaseType = testCaseType;
          }
  
          public boolean isActiveTestCase() {
              return activeTestCase;
          }
  
          public void setActiveTestCase(boolean activeTestCase) {
              this.activeTestCase = activeTestCase;
          }
  
          public String getCurrentStatus() {
              return currentStatus;
          }
  
          public void setCurrentStatus(String currentStatus) {
              this.currentStatus = currentStatus;
          }
      }
  
      private String schedulerName;
      private int activeTestCasesCount;
      private int subTaskCount;
      private SubTasks subTasks ;
      private String schedulerStatus;
  
      public String getSchedulerName() {
          return schedulerName;
      }
  
      public void setSchedulerName(String schedulerName) {
          this.schedulerName = schedulerName;
      }
  
      public int getActiveTestCasesCount() {
          return activeTestCasesCount;
      }
  
      public void setActiveTestCasesCount(int activeTestCasesCount) {
          this.activeTestCasesCount = activeTestCasesCount;
      }
  
      public int getSubTaskCount() {
          return subTaskCount;
      }
  
      public void setSubTaskCount(int subTaskCount) {
          this.subTaskCount = subTaskCount;
      }
  
      public String getSchedulerStatus() {
          return schedulerStatus;
      }
  
      public void setSchedulerStatus(String schedulerStatus) {
          this.schedulerStatus = schedulerStatus;
      }
  
  
      public SubTasks getSubTasks() {
          return subTasks;
      }
  
      public void setSubTasks(SubTasks subTasks) {
          this.subTasks = subTasks;
      }
  
      @Override
      public String toString() {
          return "SmtStatus{" +
                  "schedulerName='" + schedulerName + '\'' +
                  ", activeTestCasesCount=" + activeTestCasesCount +
                  ", subTaskCount=" + subTaskCount +
                  ", subTasks=" + subTasks +
                  ", schedulerStatus='" + schedulerStatus + '\'' +
                  '}';
      }
  }
  </code></pre>
  
  <p>And i am parsing it like this:-</p>
  
  <pre><code> private static final Type STATUS_TYPE = new TypeToken&lt;ArrayList&lt;SmtStatus&gt;&gt;() { }.getType();
   private static final Type STATUS_TYPE_Object = new TypeToken&lt;SmtStatus&gt;() { }.getType();
  </code></pre>
  
  <p>Case 1:</p>
  
  <pre><code>List&lt;SmtStatus&gt; list = getGson().fromJson(result, STATUS_TYPE);
  </code></pre>
  
  <blockquote>
    <p>com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
    Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $</p>
  </blockquote>
  
  <p>or</p>
  
  <p>Case 2:</p>
  
  <pre><code>List&lt;SmtStatus&gt; list = getGson().fromJson(result, STATUS_TYPE_Object );
  </code></pre>
  
  <blockquote>
    <p>java.lang.IllegalStateException: Expected BEGIN_OBJECT but was
    BEGIN_ARRAY at line 1 column 276 path $.subTasks</p>
  </blockquote>
  
  <p>Any help is really appreciated.</p>