0

Wondering if there is a way to make restlet jackson extension to parse jsr310 LocalDateTime? At the moment it (version 2.3.9 of RESTlet) throws this exception:

... com.fasterxml.jackson.databind.JsonMappingException: 
No suitable constructor found for type [simple type, class java.time.LocalDateTime]: can not instantiate from JSON object (need to add/enable type information?)
 at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@1a3869f4; line: 1, column: 52] (through reference chain ...

This question is not about jackson -- it does digest jsr310 datatypes (jackson-modules-java8) -- the question is about the restlet extension that is built upon jackson.

I can see that my server (restlet 2.3.9) sends this as JSON:

...,
"startTime":{"monthValue":4,"year":2017,"month":"APRIL","dayOfMonth":6,"dayOfWeek":"THURSDAY","dayOfYear":96,"hour":10,"minute":1,"second":4,"nano":836000000,"chronology":{"id":"ISO","calendarType":"iso8601"}},
...

but the same restlet 2.3.9-built client is unable to parse this...

Thanks!

seninp
  • 712
  • 1
  • 6
  • 23
  • 1
    Step 1 is to put your JSON through a JSON linter/prettifier, and make sure it's really valid JSON. The first result on Google for "json linter" (which, admittedly, is a specific term you might not have known) is [this site](http://jsonlint.com/), which seems to be good. It says that your JSON is invalid, because it's not wrapped in `{}`. (and possibly more errors that are not visible because it might only show one at a time) – Nic Apr 07 '17 at 03:45
  • Oh, sorry for not being clear, it's an excerpt from a larger JSON encapsulating my whole object -- I just put that example to show that the LocalDateTime field is getting "JSONized" properly (my guess) by the server, it is the client that throws the above exception digesting it. Thank you! – seninp Apr 07 '17 at 15:20

0 Answers0