Open
Description
(from Jackson user forum by Rich M)
Hi all. I am using jackson 1.7.1 and xml-databind 0.5.3, and ran into a minor issue. I have an attribute of type Object, which is unavoidable because its value can be a primitive or an Enum. I have tagged the attribute with @JsonTypeInfo. Everything works fine in JSON, however, the xml is erroneous when working with an Enum:
public class MyClass {
@JsonTypeInfo(use=JsonTypeInfo.Id.MINIMAL_CLASS, include=JsonTypeInfo.As.PROPERTY, property="__type")
public Object value;
}
The JSON fragment for an Enum is:
"value" : [ "PersonBloodTypeCode", "ABMNUS" ]
The XML fragment does not nest properly. It looks like:
<value>PersonBloodTypeCode</value>
<value>ABMNUS</value>
Which, when deserialized, results in a String instance "ABMNUS", rather than an enum.