title: Android Gson, error trying to parse json response from server
body: <p>The Json is valid but while parsing via. Gson, it gives error:</p>
  
  <blockquote>
    <p>com.google.gson.JsonSyntaxException: java.lang.IllegalStateException:
    Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 439</p>
  </blockquote>
  
  <p>I've pasted the entire Json <a href="https://pastebin.com/9mrZ6PJ7" rel="nofollow noreferrer">here</a>.</p>
  
  <p>The column 439 refers to the last character(quotes) in <code>"formFields":[{"</code> (5th line in paste bin).</p>
  
  <p>Code to parse:</p>
  
  <pre><code>JSONArray results = jsonObject.getJSONArray("results");
  String s = results.toString();
  Type token = new TypeToken&lt;List&lt;Form&gt;&gt;(){}.getType();
  List&lt;Form&gt; formArrayList1 = new Gson().fromJson(s, token);
  </code></pre>
  
  <p>Form model has all the elements in each json object in the root json array.</p>
  
  <pre><code>public class Form{
         -------
         -------
         JSONArray formFields;
         -------
  }
  </code></pre>
  
  <p>Any help will be appreciated! </p>