-
Bug
-
Resolution: Done
-
Major
-
29.0.1.Final
-
None
-
-
Low
-
---
-
---
Deserialization of this text leaves the field "identifier" null :
String s = "{\n" + " \"@type\": \"DataRequest\",\n" + " \"description\": \"Fetch yesterday prices\",\n" + " \"formatting\": {\n" + " \"@type\": \"MediaType\",\n" + " \"outputMediaType\": \"application/json\"\n" + " },\n" + " \"identifier\": \"uNrreFadSZPc\"\n" + "}"; Request request = JsonbBuilder.create().fromJson(s, Request.class);
But if I change the order and put "formatting" at the end, it works : identifier is not null.
String s = "{\n" + " \"@type\": \"DataRequest\",\n" + " \"description\": \"Fetch yesterday prices\",\n" + " \"identifier\": \"uNrreFadSZPc\",\n" + " \"formatting\": {\n" + " \"@type\": \"MediaType\",\n" + " \"outputMediaType\": \"application/json\"\n" + " }\n" + "}";
Here are my classes :
@JsonbTypeInfo({
@JsonbSubtype(alias = "DataRequest", type = RequestData.class)
})
public class Request {
@JsonbProperty("description")
private String description;
@JsonbProperty("identifier")
private String identifier;
@JsonbProperty("formatting")
private Formatting formatting;
//setter, getter
}
public class RequestData extends Request {
}
@JsonbTypeInfo({
@JsonbSubtype(alias = "MediaType", type = FormattingMediaType.class)
})
public class Formatting {
}
public class FormattingMediaType extends Formatting {
@JsonbProperty("outputMediaType")
private String outputMediaType;
//public getter/setter
}
- is incorporated by
-
WFLY-19784 Upgrade Eclipse Yasson from 3.0.2 to 3.0.4
-
- Closed
-