I know there are several questions of the same topic but I don't think they quite cover my problem in a Spring Boot 2 application.
I have a model which uses LocalTimeDate. Getting this via rest api works fine, date is of the format "date":"2019-12-17T08:50:00"
I have created Serializer so that the json output is customised as there are reference fields that I do not want expanded.
The relevant code in the custom serialzer is
jgen.writeStringField("date", formatter.format(value.date));
with formatter as
private SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
I apply @JsonSerialize using the custom serialzer class to the model class. The result is
{"timestamp":"2019-12-25T10:57:50.482+0000","status":500,"error":"Internal Server Error","message":"Could not write JSON: Cannot format given Object as a Date; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Cannot format given Object as a Date (through reference chain: java.util.ArrayList[0])","path":"/api/v1/climates"}
I have used https://codeboje.de/jackson-java-8-datetime-handling/ as a guide and so updated the pom and application.properties and then allowed Spring to do its magic.
Is there something I have missed?