title: Retrofit: GSON custom deserialization of children list
body: <p>I am having problems deserializing a custom object using gson.
  I have this class:</p>
  
  <pre><code>public class Content implements java.io.Serializable {
  
      private Long id;
      private int tipo;
      private String title;
      private String content;
      private Integer reward;
      /** Not-null value. */
      private String imageUrl;
      private String bannerUrl;
      private String logoUrl;
      /** Not-null value. */
      private String actionUrl;
      private Integer templateType;
      private String expiresAt;
      private Integer unlockReward;
      private Integer reportType;
      private String completionType;
      private Integer interactionType;
      private Integer productId;
      private Integer views;
      private Boolean saved;
      private Double weight;
  
      /** Used to resolve relations */
      private transient DaoSession daoSession;
  
      /** Used for active entity operations. */
      private transient ContentDao myDao;
  
      private List&lt;Rule&gt; ruleList;
      private List&lt;Category&gt; categoryList;
      ...
      // all getters and setters code
      ...
  }
  </code></pre>
  
  <p>What I want is to deserialize the categoryList using a custom adapter. I created one using the following code:</p>
  
  <pre><code>Type typeOfListOfCategory = new com.google.gson.reflect.TypeToken&lt;List&lt;Category&gt;&gt;(){}.getType();
  builder.registerTypeAdapter(typeOfListOfCategory, new JsonDeserializer&lt;List&lt;Category&gt;&gt;() {
      @Override
      public List&lt;Category&gt; deserialize(JsonElement element, Type type,
          JsonDeserializationContext context) throws JsonParseException {
      // my code goes in here
      }
  });
  Gson gson = builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create();
  </code></pre>
  
  <p>And then I used it on a rest adapter</p>
  
  <pre><code>RestAdapter restAdapter = new RestAdapter.Builder()
      .setEndpoint("http://localhost/api")
      .setConverter(new GsonConverter(gson)).build();
  </code></pre>
  
  <p>But my custom adapter is never called.</p>
  
  <p>The json that I am receiving is like this:</p>
  
  <pre><code>[
      {
          "id": 1,
          "tipo": 1,
          "title": "title",
          "content": "content",
          "reward": 2.0,
          "image_url": "url1",
          "banner_url": "url2",
          "logo_url": "url3",
          "action_url": "url4",
          "template_type": 0,
          "expires_at": "2014-08-31T00:00:00.000Z",
          "unlock_reward": 2,
          "report_type": 0,
          "completion_type": 0,
          "rules": [
              {
                  "range": "1",
                  "operator": "==",
                  "key": "key1"
              }
          ],
          "categories": [
              {
                  "description": "description"
              }
          ]
      },
      ...
  ]
  </code></pre>
  
  <p>Any ideas?</p>