04/07/2020, 11:54 PM
Hi, I’m trying to handle a response from a ReST API with Ktor Client. This API has several types of response depending if it is a success or an error. I’m trying to handle this with a Sealed class. But I fail to do it. I tried using Gson/Jackson and Json. I saw the polymorphic ( documentation but I have an issue because one of the attributes of the API is ‘type’ and it’s the classDiscriminator by default and I tried to change it with JsonConfiguration but with no success. I am quite stuck. Any help doing this ? Do you a tutorial, some information ? Thanks. If it is needed I can give access to the code in github ( Everything is in the Application.kt file (

Johannes Zick

04/08/2020, 8:47 AM
I have not tried this before. But comparing those links, have you tried specifying the type names explicitly? By default it should use fully qualified class names, but maybe that still helps.