0

When using the new Java 8 java.time.Instant type on some fields in a MongoDB Document and then exposing that with a @RepositoryRestResource, the fields will be displayed somewhat like this:

{
  "createdAt": {
    "content": "2017-01-01T00:00:00.000Z"
  }
}

What i would expect them to look like is this:

{
  "createdAt": "2017-01-01T00:00:00.000Z"
}

How can I fix this behavior?

Jochen Ullrich
  • 568
  • 3
  • 22
  • Check those threads http://stackoverflow.com/q/39170405/5873923, http://stackoverflow.com/q/39172792/5873923. Which version of Spring/Spring Data MongoDB / Sprint Data Rest (via Spring Boot maybe?) are you using? – Marc Tarin Feb 22 '17 at 16:06
  • Thank you, I was already at 1.4.1 but upgrading to 1.4.2 did indeed help. Do you want to post this as an answer so I can accept it? – Jochen Ullrich Feb 23 '17 at 08:48

1 Answers1

0

If you're using Spring Boot, you are probably facing an issue that appeared with release 1.4.0, and was fixed in release 1.4.1 (or possibly 1.4.2, depending on some annotations being present in your application or not).

Community
  • 1
  • 1
Marc Tarin
  • 3,109
  • 17
  • 49