title: Deserializing JSON to non-static nested classes using Gson
body: <p>According to <a href="http://programmerbruce.blogspot.com/2011/06/gson-v-jackson.html#TOC-Nested-Classes-including-Inner-Clas" rel="nofollow">this</a> Gson can deserialize to inner classes. I have the next fragment of JSON string:   </p>
  
  <pre><code>...
  "coordinates": {
      "coordinates": [106.80552006,-6.22016938],
      "type": "Point",
  }
  ...
  </code></pre>
  
  <p>I'm using the next class:</p>
  
  <pre><code>public class Tweet {
    public Coordinates coordinates = new Coordinates();
  
    public class Coordinates {
      public double[] coordinates;
    }
  }
  </code></pre>
  
  <p>and trying to parse the my JSON string:</p>
  
  <pre><code>Tweet tweet = gson.fromJson(string, Tweet.class);
  Tweet.Coordinates tweetCoordinates = gson.fromJson(string, Tweet.Coordinates.class);
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>Expected BEGIN_ARRAY but was BEGIN_OBJECT
  </code></pre>
  
  <p>Could you please tell me where the mistake is?</p>