<Handling inconsistent types from an Api using Ret...
# stackoverflow
u
Handling inconsistent types from an Api using Retrofit and Moshi pretty new to Kotlin so this is probably going to be very obvious to some of you. I'm trying to hit an API returning JSON using Retrofit and Moshi which returns inconsistent types based on whether one or more attributes are available. For example: people: { name: "Joe Blogs" } or people: [ { name: "Joe Bloggs" }, { name: "Sally Smith" } ] I haven't used a strictly typed language before but gather that I need to create a data class to determine what the API response will...