I would like to group certain XML attributes into a nested object. Given XML that looks like this:
<root a="1" b="2" x="3" y="4" />
I want to map the data to POJOs that are structured like this:
class Root {
public GroupA groupa;
public GroupX groupx;
}
class GroupA {
public String a;
public String b;
}
class GroupX {
public String x;
public String y;
}
Is that something that is possible using jackson-databind-xml?
Use of @JsonUnwrapped
for groupa
and groupx
would allow flattening of those. And then possibly use of annotation for denoting serialize-as-attribute (@JacksonXmlProperty(attribute=true)
or something) on properties could do it.