I have a Date format coming from API like this:
"start_time": "2015-10-1 3:00 PM GMT+1:00"
Which is YYYY-DD-MM HH:MM am/pm GMT timestamp.
I am mapping this value to a Date variable in POJO. Obviously, its showing conversion error.
I would like to know 2 things:
- What is the formatting I need to use to carry out conversion with Jackson? Is Date a good field type for this?
- In general, is there a way to process the variables before they get mapped to Object members by Jackson? Something like, changing the format, calculations, etc.
Best Answer
Since Jackson v2.0, you can use @JsonFormat annotation directly on Object members;