I'm getting an exception when attempting to deserialize an JSON string which contains date strings to a POJO using Joda.
I'm using Jackson2 with Spring and Robospice.
I'm getting the following exception:
Could not read JSON: Can not instantiate value of type [simple type, class org.joda.time.DateTime] from String value ('2014-07-25T00:00:00'); no single-String constructor/factory method
Here's the code I have at present:
MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter
= new MappingJackson2HttpMessageConverter();
mappingJackson2HttpMessageConverter.getObjectMapper().registerModule(new JodaModule());
msgConverters.add(mappingJackson2HttpMessageConverter);
restTemplate.setMessageConverters(msgConverters);
HttpEntity<?> httpEntity = new HttpEntity<Object>(headers);
final ResponseEntity<HolidayList> responseEntity
= restTemplate.exchange(url, HttpMethod.GET, httpEntity,HolidayList.class);
The POJO fields are defined like so:
private DateTime departureDate;
I had this working in Jackson1... but can't seem to get it working in Jackson2.