I would use custom serializer in Moshi with Sealed...
# squarelibraries
j
I would use custom serializer in Moshi with Sealed interface/class. But depends if having more than x, y, z or more complicated fields. You could evaluate which fields exists and switch class representation based on that. I did this a couple of times in the past. I would say it depends how you want to consume your Moshi models in UI or such later on, whats most benefitial for the use case depends 🙂 From my experience I avoid using Maps, as most often complicating stuff imo and complexer writing loops and transformations later on.