Skip to content Skip to sidebar Skip to footer

Moshi Cannot Parse Nullable

Hello) Hope you can help me. Using kotlin (Retrofit2 + moshi) i getting data from 'https://api.spacexdata.com/v3/launches' and parsing it. All is going fine (i getting attributes l

Solution 1:

mission_patch is not in the root object like flight_number etc. It's nested inside links. So your model should match. Try this:

data class SpaceXProperty(
       val  flight_number: Int,
       val mission_name: String,
       val links: Links) {

    data class Links(val mission_patch: String?)
}

Post a Comment for "Moshi Cannot Parse Nullable"