I am using spring-boot and I have an entity class defined something like this
import org.joda.time.LocalDateTime;
@Entity
public class Project {
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentLocalDateTime")
private LocalDateTime start_date;
...
...
}
When this class is converted to JSON, the field gets converted to the following string representation
{"start_date":[2014,11,15,0,0,0,0],...., ...}
I want to have the json response as yyyy-MM-dd
.
I tried the @DateTimeFormat(iso = ISO.DATE)
annotation and that did not help either.
Is there an easy way to do this conversion to proper json format ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…