I have this json string:
{
"startDate" : "2014-12-17T14:31:40Z",
"name" : "Izek",
"age" : 12
}
When I convert it with Jackson to Map[String, Object]
the type of startDate
is String
how I can tell Jackson to convert it to DateTime
type?
You need to explicitly set the data format in the objectMapper. You could refer Date format Mapping to JSON Jackson for more details. Alternately, you could do it as http://java.dzone.com/articles/how-serialize-javautildate
Have you considered a custom map deserializer? You can try to parse the date in there. If not known in advance, you'll probably hit a performance hit here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With