How to invoke another serializer from a custom Gson JsonSerializer?
问题 I have my custom class User : class User { public String name; public int id; public Address address; public Timestamp created; } I'm now creating a custom JsonSerializer for User.class: @Override public JsonElement serialize(User src, Type typeOfSrc, JsonSerializationContext context) { JsonObject obj = new JsonObject(); obj.addProperty("name", src.name); obj.addProperty("id", src.id); obj.addProperty("address", src.address.id); // Want to invoke another JsonSerializer (TimestampAdapter) for