开发中,当前端定义字段与服务端返回字段不一致,或服务端使用的是关键词(如:python的class),可以使用简单的注解变量的方式来解决这样的问题了。 12 @SerializedName("class")private String className; “class”为接口返回字段, “className”为本地使用字段, @SerializedName将接收到的“class”字段的数据赋值给“className”。 赞微海报分享
近期评论