'How to apply TypeConverter of type "Any" from Model Response from API?
I am using https://www.themealdb.com/api.php as my API. Now, when I tried to generate a class from JSON, some fields are of type "Any". How can I apply a TypeConverter for that?
This is the generated Data class of Meal:
@Entity(
tableName = "meals"
)
data class Meal(
@PrimaryKey(autoGenerate = true)
val id : Int? = null,
val dateModified: Any,
val idMeal: String,
val strArea: String,
val strCategory: String,
val strCreativeCommonsConfirmed: Any,
val strDrinkAlternate: Any,
val strImageSource: Any,
val strIngredient1: String,
val strIngredient10: String,
val strIngredient11: String,
val strIngredient12: String,
val strIngredient13: String,
val strIngredient14: String,
val strIngredient15: String,
val strIngredient16: String,
val strIngredient17: String,
val strIngredient18: String,
val strIngredient19: String,
val strIngredient2: String,
val strIngredient20: String,
val strIngredient3: String,
val strIngredient4: String,
val strIngredient5: String,
val strIngredient6: String,
val strIngredient7: String,
val strIngredient8: String,
val strIngredient9: String,
val strInstructions: String,
val strMeal: String,
val strMealThumb: String,
val strMeasure1: String,
val strMeasure10: String,
val strMeasure11: String,
val strMeasure12: String,
val strMeasure13: String,
val strMeasure14: String,
val strMeasure15: String,
val strMeasure16: String,
val strMeasure17: String,
val strMeasure18: String,
val strMeasure19: String,
val strMeasure2: String,
val strMeasure20: String,
val strMeasure3: String,
val strMeasure4: String,
val strMeasure5: String,
val strMeasure6: String,
val strMeasure7: String,
val strMeasure8: String,
val strMeasure9: String,
val strSource: String,
val strTags: Any,
val strYoutube: String
)
Unlike other API, example (NewsAPI) it generated a custom class of type Source and then from there, I can provide a converter easily.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
