Deserializing date from ASP.NET, with Jackson

久未见 提交于 2019-12-11 01:29:32

问题


I have a date in a json string (returned from an ASP.NET rest service) that looks like this: "created": "/Date(1277931782420-0700)/"

Jackson is not able to parse this date. I can write my own date format and pass it in to mapper.getDeserializationConfig().setDateFormat(); but i was wondering if there is an easier/better way to do this...


回答1:


I think defining date format is a reasonable way to do it. Alternatively you could define your own JsonDeserializer, register it, but it's not any simpler way (but may be more powerful if you need more complex parsing).



来源:https://stackoverflow.com/questions/3152076/deserializing-date-from-asp-net-with-jackson

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!