I am newbie in kotlin and I try to copy a JSON structure to another one in an efficient way.
I have an API called getData() how send back a data structure defined as below:
data class DataA(
var id: String,
var cartItems: List<CartItem>,
}
When the getData sent back the DataA structure, I have to map or translate it to another structure defined as below:
data class DataB(
var cartItems: List<CartItem>,
}
Is there an easy way to do it? I know that kotlin can easily encapsulate calls to make it nice.
Thanks