With GSON we used @SerializedName
to parse JSON object which didn't have the same key to that of the variable name in Kotlin.
data class User (
@SerializedName("id")
long userId;
@SerializedName("fullName")
String name;
)
In kotlinx.serialization
we can serialize an object like this but how to give different JSON key to a varaible during (de)serialization?
@Serializable
data class User (
long userId;
String name;
)
@Serializable
for each network entities :) – Pasquinade