Correct boolean serialization #73

Merged
AmineB merged 1 commits from davidoskky/ReaderForSelfoss-multiplatform:swiping into master 2022-10-04 18:40:15 +00:00

View File

@ -138,7 +138,11 @@ class SelfossModel {
object BooleanSerializer : KSerializer<Boolean> {
override fun deserialize(decoder: Decoder): Boolean {
val json = ((decoder as JsonDecoder).decodeJsonElement()).jsonPrimitive
return json.booleanOrNull ?: json.int == 1
return if (json.booleanOrNull != null) {
json.boolean
} else {
json.int == 1
}
}
override val descriptor: SerialDescriptor