title: JSON Serialization of Subclass to Superclass
body: <p>I have two classes:</p>
  
  <p>Superclass:</p>
  
  <pre><code>public class A
  {
      public int a;
  
      public A(int a)
      {
          this.a = a;
      }
  }
  </code></pre>
  
  <p>Subclass:</p>
  
  <pre><code>public class B extends A
  {
      public B(int a)
      {
          super(a);
      }
  }
  </code></pre>
  
  <p>I use Jackson to serialize/deserialize instances of A &amp; B.</p>
  
  <p><strong>I would like class B to be serialized to A</strong>. I would expect this to be straight forward as B doesn't have any members.
  But I get an exception from Jackson and the only solution I've found is declaring B as a subtype of A - and I don't want to use this solution because this way B is serialized and deserialized to B.</p>
  
  <p>My limitation is that I can't create another classes to contain A/B (container).</p>