Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstantConverter failed to create Instant from number value #18

Open
longtimeago opened this issue Sep 10, 2016 · 1 comment
Open

InstantConverter failed to create Instant from number value #18

longtimeago opened this issue Sep 10, 2016 · 1 comment

Comments

@longtimeago
Copy link

If json has time field represented as number of milliseconds InstantConverter failed to deserialize it

java.time.format.DateTimeParseException: Text '1472545956124' could not be parsed at index 0
@longtimeago longtimeago changed the title InstantConverter failed to create Instant from long value InstantConverter failed to create Instant from number value Sep 10, 2016
@gkopff
Copy link
Owner

gkopff commented Sep 11, 2016

Presently all the converters are only designed to "round-trip" their data. In the case of the Instant, the JSON form is 2016-09-11T22:41:51.335Z - the expected format it isn't the epoch value as a number.

I don't get a lot of time to work on this project - and the round-tripping of values currently meets my personal needs. That said, if you're able to to propose a converter configuration strategy that we can agree on, and provide the pull requests, I am happy to merge it and then release it to Maven Central.

Off the top of my head, it seems Instant is the only class that can accurately be represented by an epoch alone, so the deserialisation side could simply check for that format and parse that way if needed. However, that's sub-optimal in that it only solves the deserialisation side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants