public class CustomJsonDateDeserializer extends JsonDeserializer<Date> { @Override public Date deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = jp.getText(); try { return format.parse(date); } catch (ParseException e) { throw new RuntimeException(e); } } }
且在字段的setter上加上注解
@JsonDeserialize(using = CustomJsonDateDeserializer.class) @JsonProperty("LAST_MODIFY_DATE") private Date lastModifyDate;