FastJson序列化后Date日期类型变成时间戳
日志

执行结果:

以上可以看到productionDate通过FastJson序列化后变成时间戳了
解决
方式一: 日期属性字段上添加@JSONField注解
@JSONField(format = "yyyy-MM-dd")
private Date productionDate;
方式二: 使用FastJson内部函数toJSONStringWithDateFormat替换toJSONString
JSONObject.toJSONStringWithDateFormat(goodsInfoDto, "yyyy-MM-dd", SerializerFeature.WriteDateUseDateFormat);
执行结果:


浙公网安备 33010602011771号