Ahren Swett
07/12/2022, 5:49 PM{
"name": "bulbasaur",
"id": 1,
"sprites": {
"back_default": "String",
"front_default": "String",
"front_female": null,
"other": {
"dream_world": {
"front_default": "String",
"front_female": null
},
"official-artwork": {
"front_default": "String"
}
}
}
}
I have data classes defined as this
@OptIn(ExperimentalSerializationApi::class)
val pokemonFormat = Json {
ignoreUnknownKeys = true
coerceInputValues = true
explicitNulls = false
isLenient = true }
@Serializable
data class Pokemon(
val name : String?,
val types : List<Type>,
val Stats: List<Stat>?,
val order : Int?,
//not sure how to use Kotlin Serialization to get this
val sprites: Map<String, ?????>
)
@Serializable
data class Type(
val type: Map<String,String>
)
@Serializable
data class Stat(
val stat: Map<String,String>
)
@Serializable
data class Other(
val other: Map<String,String>
)
Tower Guidev2
07/13/2022, 7:54 AMTower Guidev2
07/13/2022, 7:55 AM