spring-boot 中的 json date format
2022-09-01 22:43:06
我正在使用spring-boot,并且我有一个实体类,定义如下
import org.joda.time.LocalDateTime;
@Entity
public class Project {
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
private LocalDateTime start_date;
...
...
}
将此类转换为 JSON 时,该字段将转换为以下字符串表示形式
{"start_date":[2014,11,15,0,0,0,0],...., ...}
我希望将 json 响应设为 .yyyy-MM-dd
我尝试了注释,也没有帮助。@DateTimeFormat(iso = ISO.DATE)
有没有一种简单的方法可以将其转换为正确的json格式?