1

In my Spring Boot application I use a following DTO with @RestController:

public abstract class ComparableQuery extends BaseQuery {

    private final Object value;

...

}

Everything works fine but when I use Spring RestTemplate and pass java.util.Date as ComparableQuery.value I see that Jackson serialize the date object into the following "magic" number:

"value":1009836000000

Right now I don't understand how the date object serialized into the 1009836000000 number representation and how to emulate it when I use for example AngularJS as a client of my back-end API. Please advise.

alexanoid
  • 24,051
  • 54
  • 210
  • 410

1 Answers1

2

This is a very similar problem as described in this answer about null handling with jackson and spring boot.

The corresponding configuration for date formatting in application.properties should look like:

spring.jackson.write-dates-as-timestamps=false
Community
  • 1
  • 1
Jörn Horstmann
  • 33,639
  • 11
  • 75
  • 118