I have a spring rest api (actually apache wicket rest api on top of spring project), that returns an object with a property which is a joda LocalDate.
Everything is fine except that the joda LocalDate/LocalTime/DateTime... they are returned in this format:
"createdDate": {
"year": 2019,
"dayOfMonth": 15,
"dayOfWeek": 1,
"era": 1,
"weekOfWeekyear": 16,
"secondOfMinute": 21,
"millisOfSecond": 455,
"dayOfYear": 105,
"millisOfDay": 72861455,
"yearOfCentury": 19,
"weekyear": 2019,
"minuteOfHour": 14,
"secondOfDay": 72861,
"yearOfEra": 2019,
"centuryOfEra": 20,
"minuteOfDay": 1214,
"monthOfYear": 4,
"hourOfDay": 20,
"zone": {
"fixed": false,
"uncachedZone": {
"cachable": true,
"fixed": false,
"id": "Australia/Perth"
},
"id": "Australia/Perth"
},
"millis": 1555330461455,
"chronology": {
"zone": {
"fixed": false,
"uncachedZone": {
"cachable": true,
"fixed": false,
"id": "Australia/Perth"
},
"id": "Australia/Perth"
}
},
"equalNow": false,
"afterNow": false,
"beforeNow": true
},
I am expecting the value to be in this format yyyy-MM-dd'T'HH:mm:ss
.
I tried using JsonFormat
annotation to the said field but with no luck.
...
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
@Field("createdDateS")
private DateTime createdDate;
...
Thanks!