I'm using Spring Boot with JPA and Jodatime.
Currently I have a model attribute annotated like this:
@Type(type="org.jadira.usertype.dateandtime.joda.PersistentLocalTime")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm")
private LocalTime startTime;
When serialized, the JSON is becoming:
{
"startTime" : {
"hourOfDay" : 12,
"minuteOfHour" : 0,
"secondOfMinute" : 0,
"millisOfSecond" : 0,
"chronology" : {
"zone" : {
"fixed" : true,
"id" : "UTC"
}
}
}
I want to know if there is a way to serialize that attribute to be like this:
{
"startTime": "12:00"
}
I have tried to put that @JsonFormat
annotation, but it does not seem to work.