title: Kotlin sealed class subtyping in Jackson
body: <p>I have following classes:</p>
  <pre class="lang-kotlin prettyprint-override"><code>@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = &quot;type&quot;)
  @JsonSubTypes(
      JsonSubTypes.Type(value = Speech::class, name = &quot;Speech&quot;),
      JsonSubTypes.Type(value = Audio::class, name = &quot;Audio&quot;),
  )
  sealed class AudioItem
  
  data class Speech(val type: String = &quot;Speech&quot;, val contentType: String = &quot;SSML&quot;, val content: String) : AudioItem()
  data class Audio(val type: String = &quot;Audio&quot;, val source: String) : AudioItem()
  </code></pre>
  <p>When I try to convert generic <code>ArrayList</code>:</p>
  <p><a href="https://i.stack.imgur.com/tRYUs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tRYUs.png" alt="ArrayList with items as LinkedHashMaps" /></a></p>
  <p>to <code>AudioItem</code></p>
  <pre class="lang-kotlin prettyprint-override"><code>val audio: List&lt;AudioItem&gt; = ObjectMapper().findAndRegisterModules().convertValue(a)
  </code></pre>
  <p>I get:</p>
  <blockquote>
  <p>Cannot construct instance of <code>AudioItem</code> (no Creators, like default constructor, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information</p>
  </blockquote>