Is there a way to 'skip' failed values in decoding...
# serialization
r
Is there a way to 'skip' failed values in decoding? So given
someSerialFormat.decodeFromString<List<MyType>>(text)
some of the values in 'text' are bad...so say I have
class MyType(val price: Double)
, and inside the serialized text a small number of entries have "price: Unknown", can I just skip those somehow and still get back a list of all the successes?
r
It's possible; you'd have to write a custom serializer to implement the logic. https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/serializers.md#custom-serializers