Mohit Sharma
10/25/2022, 7:33 PMCaused by: kotlinx.serialization.json.internal.JsonDecodingException: Polymorphic serializer was not found for missing class discriminator ('null')
2022-10-25 20:31:56.910 4548-4548/com.socialpillars.ngo E/AndroidRuntime: JSON input: .....te_time":"2022-03-30T06:43:29.433318+05:30","type":"post"}]}
data class Posts(
@SerialName("uuid") val postId: String,
@SerialName("description") val description: String,
@SerialName("likes_count") var likesCount: Int,
@SerialName("images") private val _images: List<Image>,
@SerialName("user") val user: User,
@SerialName("is_liked") var isLiked: Boolean,
@SerialName("create_time") private val _eventStartTime: String,
var isMyPost: Boolean = false
)
data class FeedItem(
@SerialName("post") var posts: Posts?,
@SerialName("event") var events: Events?,
@SerialName("type") var type: FeedType
)
Casey Brooks
10/25/2022, 7:43 PM"type":"post"
to your Posts
class. You’d either need to explicitly deserialize the Posts class (json.decodeFromString<Posts>(jsonString)
), or else configure polymorphic serialization to set up that mappingMohit Sharma
10/25/2022, 7:46 PMFeedItem
class mapping needs to update to parse FeedType object ?