jackson解析LocalDateTime报错解决

在字段上添加注释

class Data {
        private String status;

        @JsonDeserialize(using = LocalDateTimeDeserializer.class)
        @JsonSerialize(using = LocalDateTimeSerializer.class)
        @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime timestamp;

        private String type;

        private Double value;
    }
posted @ 2022-10-16 12:20  xl4ng  阅读(180)  评论(0编辑  收藏  举报