title: Jackson conditional deserialization
body: <p>I'd like to deserialize JSON into pojos in different ways, depending on the incoming json. For example, the incoming JSON could come in one of two forms:</p>
  
  <pre><code>{
      "foo": {
          "name": "a name",
          "another": "value"
      }
  }
  </code></pre>
  
  <p>or </p>
  
  <pre><code>{
      "foo": "a name"
  }
  </code></pre>
  
  <p>The receiver pojos:</p>
  
  <pre><code>class Container {
      Foo foo;
  }
  
  class Foo {
      String name;
      String another;
  }
  </code></pre>
  
  <p>The first case is easy, the default behavior handles it. In the second case, though, I'd like to have the system create a Foo and then assign the incoming string to the "name" field.</p>
  
  <p>I could not figure out how to do this using Jackson's support for polymorphic deserialization. Is it possible?</p>