I am unable to deserialize Java-8-LocatDate because of following exception
JSON parse error: Cannot deserialize value of type java.time.LocalDate
from String "15/09/1978": Failed to deserialize java.time.LocalDate (java.time.format .DateTimeParseException) Text '15/09/1978' could not be parsed at index 0;
JSON request object containing Date is as follow
[ "employeeName" : "ABC XYZ", "birthDate" : "15/09/1978" ]
I also tried to implement date deserialization by referring to URL Deserialize Java 8 LocalDateTime with JacksonMapper However,following line of code
@DateTimeFormat(iso = DateTimeFormatter.ofPattern("dd/mm/yyyy")) gave following compilation error
Type mismatch: cannot convert from DateTimeFormatter to DateTimeFormat.ISO
in the line
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="EMP_ID", updatable = false, nullable = false)
private long empId;
@Column(name="BIRTH_DATE")
//below line gave compilation error ==> Type mismatch: cannot convert from DateTimeFormatter to DateTimeFormat.ISO
@DateTimeFormat(iso = DateTimeFormatter.ofPattern("dd/mm/yyyy"))
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern="dd/mm/yyyy")
private LocalDate birthDate;
Please help me to resolve this issue, Thanks in advance