On Tue, Sep 26, 2017 at 3:41 AM, David Rodriguez Gonzalez <davidrg131...@gmail.com> wrote: > Hello, > > I am trying to serialize into XML this: > > public class Box<T> { > > private T boxed; > } > > with the next specific class type: > > public class Person { > // fields > } > > but I get the next xml: > > <box> > <boxed>...</boxed> > </box> > > instead of: > > <box> > <person>....</person> > </box> > > > any ideas? Is there any annotations I could use to pick the generic type > root name instead of the property name?
No; properties are not named based on types, but only on names of property or annotations. So you would have to use `@JsonProperty` (or `@JacksonXmlProperty`) annotation to change the name used. One exception there is would be use of polymorphic types (@JsonTypeInfo), where it is possible to actually use type id as key (with `As.WRAPPER_OBJECT`). -+ Tatu +- -- You received this message because you are subscribed to the Google Groups "jackson-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscr...@googlegroups.com. To post to this group, send email to jackson-user@googlegroups.com. For more options, visit https://groups.google.com/d/optout.