I\'m trying to learn Gson and I\'m struggling with field exclusion. Here are my classes
public class Student {
private Long id;
privat
Kotlin's @Transient
annotation also does the trick apparently.
data class Json(
@field:SerializedName("serialized_field_1") val field1: String,
@field:SerializedName("serialized_field_2") val field2: String,
@Transient val field3: String
)
Output:
{"serialized_field_1":"VALUE1","serialized_field_2":"VALUE2"}