I'm trying to serialize a Timestamp
Object to a JSON. But the object in the JSON is displayed as seconds.
This is a snippet of my POJO:
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class TimeAndDateDetail{
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh.mm.ss")
private Timestamp timeAndDate;
public Timestame getTimeAndDate() {return timeAndDate; }
public void setTimeAndDate(Timestamp timeAndDate){
this.timeAndDate = timeAndDate;
}
}
This is my output:
{
"timeAndDate": 1583038800000
}
Why is this happening? And how can I get it to keep its original format?