0

I want to map the date from json to java. I annotated the property in my mapping class like this:

@DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
@SerializedName("AdvancedDate")
private LocalDateTime advancedDate;

when this is executed it produces this error:

 java.time.format.DateTimeParseException: Text '2018-02-05T08:59:43.323'     could not be parsed at index 23

The input is: '2018-02-05T08:59:43.323'

Json structure:

TradeId":123,"SellerCompany":"ACME","Currency":"GBP","AdvancedDate":"2018-02-05T08:59:43.323","ExpectedPaymentDate":"2018-02-23T00:00:00","PercentageNotional":10.00000,"TradeFaceValue":1111.64,"AmountAdvanced":111.78000,"AmountOutstanding":589.78000,"PriceGrade":"4","AdvanceRate":85.00000000,"DiscountFee":0.800,"PaymentStatus":"Awaiting payment","MiInvestorFeePercentage":15.00000,"AuctionType":"Single/Select Invoice","CrystallisedLosses":0.0,"CrystallisedLossDate":null,"DelinquencyDate":null,"DiscountOn":"Advance","DebtorName":"Donald Trump","IsAdvanced":true

How to map this value to LocalDateTime without parsing errors?

Stimpson Cat
  • 1,444
  • 19
  • 44

0 Answers0