Is it possible to disable automatic String to Int ...
# serialization
s
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
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?)
I think you should make a feature request https://github.com/Kotlin/kotlinx.serialization/issues