Nice, I saw that code somewhere and I tried, but the problem was that I wasn't getting the .serializer() method generated in the companion object. I'll try again as soon as I reach my office. I suppose it was a problem with the kotlinx-serialization gradle plugin. Thanks!