JSON PARSE ERROR: Der Wert des Typs `java.time.localdatetime` von String kann nicht deserialisieren.

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: JSON PARSE ERROR: Der Wert des Typs `java.time.localdatetime` von String kann nicht deserialisieren.

by Anonymous » 19 Aug 2025, 18:14

Ich sende Anfrage an einen externen Dienst, der die Eigenschaft aktualisiert hat < /p>

Code: Select all

@UpdateTimestamp
@Column(name = "updated_date")
private LocalDateTime updatedDate;
< /code>

Wenn ich die Antwort in meinem DTO erhalte, versuche ich, die LocalDatetime -Eigenschaft wie diese zu formatieren@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime updatedDate;
< /code>

, aber ich erhalte einen Fehler in Postman < /p>

"message": "JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String \"2020-04-14T10:45:07.719\": Text '2020-04-14T10:45:07.719' could not be parsed at index 14; nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `java.time.LocalDateTime` from String \"2020-04-14T10:45:07.719\

Top