0

I am trying to create a Java object based on the json file.

{  
  "id": "10",  
  "customerId": "199",  
  "startDate": "2017-01-01T01:42:50.622Z"  
}

Here is my code snippet

String payload = new File(Jsonpath).text;  
ObjectMapper mapper = new ObjectMapper()  
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false)  
Bill bill = mapper.readValue(payload, Bill.class)

i am getting the following error. Appreciate your help.

com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of java.time.OffsetDateTime: no String-argument constructor/factory method to deserialize from   
String value ('2017-01-01T01:42:50.622Z')  
 at [Source: {  
  "id": "10",  
  "customerId": "199",  
  "startDate": "2017-01-01T01:42:50.622Z"  
}
ProgrammerBoy
  • 876
  • 6
  • 19
user3777385
  • 31
  • 1
  • 8

0 Answers0