I'm trying to map an object to JSON. This works fine, but I also want to expose the @Id
in JSON. I've found this answer on how to do that, but in order to use that solution, I have to extend RepositoryRestMvcConfiguration
. When I extend this, my Java 8 time formatting is breaking. My JSON was as follows:
{"name":"erik",birthDate:"2015-01-01"}
The birthDate field is a Java 8 LocalDate. Now, I also try to expose the @Id
, which I do by extending RepositoryRestMvcConfiguration
and setting the configuration.exposeIdsFor(MyClass.class);
. Now I have the Id exposed, but, as a result of extending RepositoryRestMvcConfiguration
, my LocalDate
is now serialized as:
"birthDate":{"year":2015,"month":"AUGUST","chronology":{"id":"ISO","calendarType":"iso8601"},"dayOfMonth":15,"dayOfWeek":"SATURDAY","era":"CE","dayOfYear":227,"leapYear":false,"monthValue":8}
So, my question is: how can I expose the Id of my class while retaining the format of my LocalDate
?