BollywoodVillain
11/23/2020, 5:46 PM@Serializable data class while encoding?
e.g. Given a data class: data class MyClass(val accessible: Boolean) and given the input JSON { "accessible": "yes" } , can we convert the accessible to Boolean from String while encoding?BollywoodVillain
11/23/2020, 6:12 PMdeserialize(decoder: Decoder) function to convert the values to Boolrnett
11/23/2020, 9:00 PM@Serializable(with = MySerializer::class) on a property if that's what you mean. See https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#specifying-serializer-on-a-propertyBollywoodVillain
11/23/2020, 9:07 PMKSerializer and overriding deserialize()
I casted decoder to jsonDecoder and then got the keys and transformed manually.BollywoodVillain
11/24/2020, 6:49 AM