title: Jackson ObjectMapper convert String to object that have inheritance
body: <p>I have some classes that look likes this:</p>
  <pre><code>@Data
  @ToString
  class Parent {
      private List&lt;Child&gt; children;
  }
  
  @Data
  @ToString
  class Child {
      private String name;
  }
  
  @Data
  @ToString
  class SubChild extends Child {
      private String subName;
  }
  </code></pre>
  <p>Now I have a JSON that look like this:</p>
  <pre><code>String json = &quot;{&quot; +
          &quot;  \&quot;children\&quot;: [&quot; +
          &quot;    {&quot; +
          &quot;      \&quot;name\&quot;: \&quot;some name\&quot;,&quot; +
          &quot;      \&quot;subName\&quot;: \&quot;some subName\&quot;&quot; +
          &quot;    }&quot; +
          &quot;  ]&quot; +
          &quot;}&quot;;
  </code></pre>
  <p>I try to convert my String to an Object Parent like this:</p>
  <pre><code>ObjectMapper objectMapper = new ObjectMapper();
  Parent parent = objectMapper.readValue(json, Parent.class);
  </code></pre>
  <p>But I got:</p>
  <pre><code>com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field &quot;subName&quot; (class com.company.Child), not marked as ignorable (one known property: &quot;name&quot;])
   at [Source: (String)&quot;{  &quot;children&quot;: [    {      &quot;name&quot;: &quot;some name&quot;,      &quot;subName&quot;: &quot;some subName&quot;    }  ]}&quot;; line: 1, column: 66] (through reference chain: com.company.Parent[&quot;children&quot;]-&gt;java.util.ArrayList[0]-&gt;com.company.Child[&quot;subName&quot;])
  
      at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:61)
  </code></pre>
  <p>But If I change:</p>
  <pre><code>private List&lt;Child&gt; children;
  </code></pre>
  <p>To:</p>
  <pre><code>private List&lt;SubChild&gt; children;
  </code></pre>
  <p>everything works well, but in my case, I can't change the model, and in future, we can have other classes that can inherit from Child.</p>
  <p>Is there any configuration that I can make to ObjectMapper to accept inheritance?</p>