Is it possible to disable automatic String to Int conversion ie. make this fail?
Copy code
@Serializable
data class Asd(
val itsAnInt: Int,
)
@Test
fun asd() {
Json.decodeFromString<Asd>("""{"itsAnInt":"1"}""")
}
a
Adam S
05/31/2024, 7:20 AM
good question, I'm surprised it works!
I don't think there's an option to control this, but possibly you could create a custom serializer (I can try and whip up a quick example, if it'd help?)