Kotlin data class parcelable

How Can i parce this class
data class MessageModel(
@SerializedName(“Id”)
var id:Long? = null,

@SerializedName("User")
var user: UserModel = UserModel(),

@SerializedName("Detail")
var detail : MessageDetailModel = MessageDetailModel()

)

What do you mean in term "parce "? Am I right, that you want to serialize your class into string/bytes and deserialize back?

As I understand, you use Gson attribute SerializedName, which means that you want to work with Gson.

If I’m right, then the question is “how to serialize Kotlin Data Class by using Gson” or something like this.

I found this link (for example) - https://www.baeldung.com/kotlin-json-convert-data-class . So could you please check, does this solution work for you?