1

I am trying to work out how to format a Typescript 'Date' field that is part of a DTO that is sent from my Angular 10 client to a Spring Boot rest service where the matching Sprint Boot field is of Java type 'Instant'.

On the Angular side if I use....

return aDate.toISOString();

.. .then on the Spring Boot side I'm getting an error...

[org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.time.Instant from String ""2021-02-26T15:51:35.505Z"":

Any suggestions?

user2868835
  • 1,250
  • 3
  • 19
  • 33
  • 1
    https://stackoverflow.com/questions/45662820/how-to-set-format-of-string-for-java-time-instant-using-objectmapper – Serg Vasylchak Feb 26 '21 at 16:53
  • That fixed it Thanks – user2868835 Mar 05 '21 at 22:29
  • Does this answer your question? [How to set format of string for java.time.Instant using objectMapper?](https://stackoverflow.com/questions/45662820/how-to-set-format-of-string-for-java-time-instant-using-objectmapper) – Ashish Ratan Feb 03 '23 at 21:01

0 Answers0