title: How do I write a custom JSON deserializer for Gson?
body: <p>I have a Java class, User:</p>
  
  <pre><code>public class User
  {
      int id;
      String name;
      Timestamp updateDate;
  }
  </code></pre>
  
  <p>And I receive a JSON list containing user objects from a webservice:</p>
  
  <pre><code>[{"id":1,"name":"Jonas","update_date":"1300962900226"},
  {"id":5,"name":"Test","date_date":"1304782298024"}]
  </code></pre>
  
  <p>I have tried to write a custom deserializer:</p>
  
  <pre><code>@Override
  public User deserialize(JsonElement json, Type type,
                          JsonDeserializationContext context) throws JsonParseException {
  
          return new User(
              json.getAsJsonPrimitive().getAsInt(),
              json.getAsString(),
              json.getAsInt(),
              (Timestamp)context.deserialize(json.getAsJsonPrimitive(),
              Timestamp.class));
  }
  </code></pre>
  
  <p>But my deserializer doesn't work. How can I write a custom JSON deserializer for Gson?</p>