title: Deserialize polypmorphic JSON types with key-based type names
body: <p>Here is the sample JSON I want to deserialize with Jackson.</p>
  
  <pre><code>{
    "person": {
      "contacts": {
        "address": {
          "type": "Office",
          "street": "1600 Amphitheatre Parkway",
          "city": "Mountain View",
          "state": "CA",
          "zip": "94043",
          "country": "United States"
        },
        "email": {
          "type": "Home",
          "emailAddress": "e.schmidt@google.com"
        },
        "phone": [
          {
            "type": "Mobile",
            "phoneNumber": "+1 888 555555"
          },
          {
            "type": "Home",
            "phoneNumber": "+1 888 1111111"
          }
        ],
        "website": {
          "type": "work",
          "webService": "URL",
          "webAddress": "www.google.com"
        }
      },
      "firstName": "Eric",
      "lastName": "Schmidt"
    }
  }
  </code></pre>
  
  <p>The tricky bit to deserialize here is the contacts node.
  Things to note:</p>
  
  <ol>
  <li>contacts is a polymorphic abstract type (see POJOs below)</li>
  <li>the type information (e.g., `addresss) is contained as a key in a wrapper</li>
  <li>this wrapper can be an object if there is only one value (<code>email</code>, <code>address</code>, <code>website</code>) <strong>OR</strong> an array if there are multiple (<code>phone</code>)</li>
  </ol>
  
  <p>Target POJOs:</p>
  
  <pre><code>public class Person
  {
      public String firstName;
      public String LastName;
      public List&lt;Contact&gt; contacts; // mixes Address, Phone, Email, Website
  }
  
  public abstract class Contact {
      public Long id;
  }
  
  public class Phone extends Contact
  {
      public String type;
      public String phoneNumber;
  }
  
  // other subtypes of Contact omitted for brevity
  </code></pre>
  
  <p>note: external requirements require that I use the abstract <code>Contact</code> type. I would rather deserialize directly to these POJOs <em>rather than having an intermediate <code>Contacts</code> POJO that the contact types hang off of and them manual mapping/converting to my List in another step.</em></p>
  
  <p>I've looked over many other jackson + polymorphic deserialization questions, but none seem to handle this case (#2 and #3 in particular).</p>
  
  <p>I want to deserialize the contacts object to a <code>List&lt;Contact&gt;</code>.</p>
  
  <p>What is proper application of <code>@JsonTypeInfo</code> and <code>@JsonSubTypes</code> needed to achieve this?</p>
  
  <p>(if anyone is interested this is <a href="http://developer.capsulecrm.com/v1/resources/parties/" rel="nofollow noreferrer">CapsuleCRM's JSON format</a>)</p>