Tower Guidev2
08/03/2023, 11:09 AM@JsonAnyGetter
@JsonAnySetter
that can be employed to cope with any unexpected json message fields?Emil Kantis
08/03/2023, 11:25 AMTower Guidev2
08/03/2023, 12:55 PMEmil Kantis
08/03/2023, 1:49 PMdecodeFromString
which prints the value if decoding fails.
inline fun <reified T> Json.decodeOrThrow(s: String): T = runCatching {
decodeFromString(d)
}.onFailure { t ->
logger.error("Failed to parse <$s> to ${T::class.simpleName}", t)
}.getOrThrow()
CLOVIS
08/03/2023, 3:53 PMJson {
ignoreUnknownKeys = true
}
Tower Guidev2
08/04/2023, 5:46 AMCLOVIS
08/04/2023, 7:55 AMignoreUnknownKeys = false
does. You don't need to do anything more.Tower Guidev2
08/04/2023, 10:02 AMCLOVIS
08/04/2023, 10:02 AMJson
instance for each remote server, with the configuration you want for that remote server.