title: How can I prevent Jackson from serializing a polymorphic type's annotation property?
body: <p>I have polymorphic types and deserializing from JSON to POJO works. I followed the documentation <a href="https://github.com/FasterXML/jackson-docs/wiki/JacksonPolymorphicDeserialization" rel="nofollow noreferrer">here</a>, in fact. When serializing POJOs into JSON I'm getting an unwanted attribute, specifically the logical type name.</p>
  <pre><code>import static org.codehaus.jackson.annotate.JsonTypeInfo.*;
  
  @JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property=&quot;type&quot;)
  @JsonSubTypes({
      @JsonSubTypes.Type(value=Dog.class, name=&quot;dog&quot;),
      @JsonSubTypes.Type(value=Cat.class, name=&quot;cat&quot;)
  })    
  public class Animal { ... }
  
  public class Dog extends Animal { ... }
  public class Cat extends Animal { ... }
  </code></pre>
  <p>When Jackson serializes into JSON it provides the type information which I don't want to expose.</p>
  <pre><code>{&quot;type&quot;:&quot;dog&quot;, ... }
  {&quot;type&quot;:&quot;cat&quot;, ... }
  </code></pre>
  <p>Can I prevent this somehow? I only want to ignore <code>type</code> when deserializing.</p>