GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
Gson gson =builder.create();
gson.fromJson(json,bean);
原文地址:https://www.cnblogs.com/meng-yi/p/9306391.html
时间: 2024-10-13 14:08:35