I am trying to use @SerialName but is not working any idea about this ??
d
Dominaezzz
03/29/2021, 7:58 PM
code pls
v
Vikas Singh
03/30/2021, 8:20 AM
Copy code
@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
)
d
Dominaezzz
03/30/2021, 8:43 AM
How does it not work? What is the output?
v
Vikas Singh
03/30/2021, 8:46 AM
the values of the keys are null where I have used @SerialName and it works when i use @SerializedName(gson serialization)
val test = HomeDetails("com","desc","fav","name", listOf("list-item"),"last","id",
"postlike","postsong","unlike","type","thumb")
println(Json.encodeToString(test))