title: Serializer for interface / implementation
body: <p>Suppose there is one interface , and 2 (or more) implementations :</p>
  
  <pre><code>interface IRunnable {
    fun run()
  }
  
  class Horse : IRunnable {
    override fun run() {    println("horse running")  }
  }
  
  class Dog : IRunnable {
    override fun run() {    println("dog running")  }
  }
  </code></pre>
  
  <p>I want to achieve the most succinct JSON for network transmission, that is , <code>{"runnable":"H"}</code> for Horse and <code>{"runnable":"D"}</code> for Dog</p>
  
  <p><strong>If I cannot modify the interface and implementations</strong> , I want to serialize the interface/implementations to JSON , according to Kotlin's documentation , I have to write a  <a href="https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/custom_serializers.md" rel="noreferrer">custom serializer</a> , and use <code>SerializersModule</code> to achieve the goal. </p>
  
  <p>Suppose there are only <code>Horse</code> and <code>Dog</code> implementing <code>IRunnable</code> , This is what I've done :</p>
  
  <pre><code>class RunnableSerializer : KSerializer&lt;IRunnable&gt; {
    override val descriptor: SerialDescriptor
      get() = StringDescriptor.withName("runnable")
  
  
    override fun serialize(encoder: Encoder, obj: IRunnable) {
      val stringValue = when (obj) {
        is Horse -&gt; { "H" }
        is Dog -&gt; { "D" }
        else -&gt; { null }
      }
      stringValue?.also {
        encoder.encodeString(it)
      }
    }
  
    override fun deserialize(decoder: Decoder): IRunnable {
      return decoder.decodeString().let { value -&gt;
        when(value) {
          "H" -&gt; Horse()
          "D" -&gt; Dog()
          else -&gt; throw RuntimeException("invalid $value")
        }
      }
    }
  }
  </code></pre>
  
  <p>But when I try to transform a <code>Horse</code> to JSON ...</p>
  
  <pre><code>class RunnableTest {
  
    private val logger = KotlinLogging.logger { }
  
    @ImplicitReflectionSerializer
    @Test
    fun testJson() {
      val module1 = serializersModuleOf(IRunnable::class, RunnableSerializer())
  
      Json(context = module1).stringify(IRunnable::class.serializer(), Horse()).also {
        logger.info("json = {}", it)
      }
    }
  }
  </code></pre>
  
  <p>It outputs error :</p>
  
  <pre><code>kotlinx.serialization.SerializationException: 
  Can't locate argument-less serializer for class IRunnable. For generic classes, such as lists, please provide serializer explicitly.
  </code></pre>
  
  <p>How to achieve something like 
  <code>{"runnable":"H"}</code> or <code>{"runnable":"D"}</code> in this case ?</p>
  
  <p>Thanks.</p>
  
  <p>environments :</p>
  
  <pre><code>&lt;kotlin.version&gt;1.3.60&lt;/kotlin.version&gt;
  &lt;serialization.version&gt;0.14.0&lt;/serialization.version&gt;
  </code></pre>
  
  <p>updated , full error message :</p>
  
  <pre><code>kotlinx.serialization.SerializationException: Can't locate argument-less serializer for class IRunnable. For generic classes, such as lists, please provide serializer explicitly.
  
      at kotlinx.serialization.PlatformUtilsKt.serializer(PlatformUtils.kt:12)
      at RunnableTest.testJson(RunnableTest.kt:17)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
      at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
      at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
  </code></pre>