Android_Question
Android_Question copied to clipboard
gson序列化数据时如何排除某个字段?
方式一:给字段加上 transient 修饰符
方式二:排除Modifier指定类型的字段。这个方法需要用GsonBuilder定制一个GSON实例。
方式三:使用@Expose注解。没有被 @Expose 标注的字段会被排除