I am using retrofit version 2.1.0 to deserialize JSON into pojos. A field in the pojo can be received under different names in the json. To deserialize the field correctly, I used the @serializedName annotation in the following way:
@AutoValue
public abstract class Media implements Parcelable {
@SerializedName(value = "title", alternate = {"name"})
public abstract String title();
// More fields and code
However, for some reason, when the resulting JSON has the field under the key "title", Gson reads it correctly, but when the field is associated with the "name" key, it does not get read.
How can I get GSON to recognize the alternate name during deserialization?