Gson

serialized: model to string
deserialized: string to model

1.SerializedName

value用于serialized或deserialized
alternate用于deserialized

@SerializedName(value = "id", alternate = "tagId")
private int id;

2.Since

Gson gson = new GsonBuilder().setVersion(1.0).create()

 public class User {
    private String firstName;
    private String lastName;
    @Since(1.0) private String emailAddress;
    @Since(1.0) private String password;
    @Since(1.1) private Address address;
  }

3.Until
统一用于verison处理

4.Expose
类似白名单,名单内的对象可以serialized,deserialized

5.JsonAdapter

你可能感兴趣的:(Gson)