Got it, you'll have to write a custom deserializer, then: https://www.baeldung.com/jackson-deserialization
-Drew On Thursday, October 29, 2020 at 2:19:31 PM UTC-4 [email protected] wrote: > Hi drewgs, yeah that is one option .But thing is in that I can't do > anything, because that Json is coming from other service. And I can't do > any manipulations in that service .So I have to do something here only to > get this LocalDateTime form deserialized. > > On Thursday, October 29, 2020 at 11:39:40 PM UTC+5:30 [email protected] > wrote: > >> You'll need to add the JSR-310 module to the program that is creating >> that JSON. >> >> -Drew >> >> On Thursday, October 29, 2020 at 6:27:37 AM UTC-4 [email protected] >> wrote: >> >>> The default jackson serialization of LocalDateTime is the format which I >>> had sended above, so why it doesn't deserializing the same format. Can >>> there be some dependency or annotations which can take care of this? >>> >>> On Wednesday, October 28, 2020 at 2:25:51 AM UTC+5:30 [email protected] >>> wrote: >>> >>>> On Tue, Oct 27, 2020 at 9:33 AM kaushik tiwari <[email protected]> >>>> wrote: >>>> >>>>> Hi all, I m facing LocalDateTimeDeserialization issue,gone through >>>>> with various blogs but didn't found the solution which can work for me. >>>>> Added JSR310 dependency as well. >>>>> >>>>> *Json which I want to get deserialized is in this form: * >>>>> {"year":2018,"month": >>>>> "JULY","monthValue":7,"dayOfMonth":20,"hour":20,"minute":3,"second":33,"nano":653000000,"dayOfWeek":"FRIDAY","dayOfYear":201,"chronology":{"calendarType":"iso8601","id":"ISO"}}} >>>>> >>>>> >>>>> >>>> >>>> That is not a format that JSR-310 module supports for `LocalDateTime`, >>>> so it will not work without a custom deserializer of some kind. >>>> It looks like someone serializing LocalDateTime without using jsr310 >>>> module, and it getting treated as POJO. >>>> You could either write a custom JsonDeserializer or, maybe, create a >>>> POJO that maps those fields and then write code to construct matching >>>> value >>>> instance (actually that would be similar to `Converter` and >>>> `StdConvertingDeserializer` approach). >>>> >>>> -+ Tatu +- >>>> >>>> >>> -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jackson-user/07a52298-849e-431a-8dfb-5dee1c59ec72n%40googlegroups.com.
