I have the following JSON object:
{"name": "Foobar", "date": "2020-07-23 17:34:24"} that I would want to deserialize into a POJO, using Jackson.
To do this, I have the following class:
public class Person { private String name; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private OffsetDatetime date; } It should work, but it doesn't, and I get an error message:
Jackson.databind.exc.InvalidDefinitionException: Cannot construct instance (no Creators, like default constructor, exist): no String-argument constructor/factory method to deserialize from String value ('2020-07-23 17:34:24')
I double checked the pattern and everything seems correct, but I am still getting this error. Anyone know why?
没有评论:
发表评论