Gson serialization depending on field value
- by Serj Lotutovici
I have a POJO that is similar to:
public class MyGsonPojo {
@Expose
@SerializedName("value1")
private String valueOne;
@Expose
@SerializedName("value2")
private boolean valueTwo;
@Expose
@SerializedName("value3")
private int valueThree;
// Getters and other stuff here
}
The issue is that this object…