Hey,

I'm trying to deserialize an XML object and use the JsonSubTypes and 
JsonTypeInfo annotations to designate the root tag name as the field we use 
to determine which sub type to deserialize to. For example:

Sample XMLs we'd like to deserialize:
<dog>
  <name>alpine</name>
</dog>

<cat>
  <name>wheezy</name>
</cat>


Our class definitions:
@JsonTypeInfo(
  use = JsonTypeInfo.Id.NAME,
  include = JsonTypeInfo.As.WRAPPER_OBJECT
)
@JsonSubTypes({
  @JsonSubTypes.Type(value = Dog.class, name = Dog.TYPE),
  @JsonSubTypes.Type(value = Cat.class, name = Cat.TYPE)
})

@FreeBuilder
@JsonDeserialize(builder = Animal.Builder.class)
public abstract class Animal {

  @JsonIgnoreProperties(ignoreUnknown = true)
  public static class Builder extends Animal_Builder {}
}

The issue right now is that it seems like Jackson is expecting a top level 
tag, <animal>. Is there any way to use the root tag name as the subtype? It 
seems like this other thread: 
https://groups.google.com/forum/#!msg/jackson-user/CZxDOmVSjGk/TD7L2Rn3FQAJ 
might suggest that this isn't possible with Jackson

Thanks,
Jason

-- 
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.

Reply via email to