eclipse-ee4j / eclipse-ee4j/yasson

JsonbDateFormat deserialization fails

Open
#162 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
218
Forks
109
Avg merge
1d 5h
Merged PRs (30d)
9

Description

Check test:

`public class ParseDateTest {

public ParseDateTest() {
}

@Test
public void testDate() {
String json = "{\"date\":\"2018-03-05\"}";
Jsonb jsonb = JsonbBuilder.create();

Form form = jsonb.fromJson(json, Form.class);

System.out.println("date:" + form.getDate());

}

public static class Form {

@JsonbDateFormat(value = "yyyy-MM-dd")
private Date date;

public Date getDate() {
return date;
}

public void setDate(Date date) {
this.date = date;
}

}
}`

Throws excepction:

`java.time.DateTimeException: Unable to obtain Instant from TemporalAccessor: {},ISO,UTC resolved to 2018-03-05 of type java.time.format.Parsed`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.