v

    Vikas Singh

    1 year ago
    I am trying to use @SerialName but is not working any idea about this ??
    Dominaezzz

    Dominaezzz

    1 year ago
    code pls
    v

    Vikas Singh

    1 year ago
    @Serializable
    data class HomeDetails(
        val comments: String,
        val description: String,
        val favorites: String,
        @SerialName("first_name")
        val firstName: String,
        @SerialName("hash_tags")
        val hashTags: List<String>,
        @SerialName("last_name")
        val lastName: String,
        @SerialName("post_id")
        val postId: String,
        @SerialName("post_like")
        val postLike: String,
        @SerialName("post_song")
        val postSong: String,
        @SerialName("post_unlike")
        val postUnlike: String,
        @SerialName("singer_type")
        val singerType: String,
        val thumbnail: String
    )
    Dominaezzz

    Dominaezzz

    1 year ago
    How does it not work? What is the output?
    v

    Vikas Singh

    1 year ago
    the values of the keys are null where I have used @SerialName and it works when i use @SerializedName(gson serialization)
    RedTahr1

    RedTahr1

    1 year ago
    The code seem OK, are you sure you are using
    import kotlinx.serialization.*
    import kotlinx.serialization.json.*
    val test = HomeDetails("com","desc","fav","name", listOf("list-item"),"last","id",
            "postlike","postsong","unlike","type","thumb")
    
    println(Json.encodeToString(test))