Gson:@Expose与@SerializedName [英] Gson: @Expose vs @SerializedName

查看:128
本文介绍了Gson:@Expose与@SerializedName的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于Gson,@Expose@SerializedName("stringValue")有什么区别?

With respect to Gson what is the difference between @Expose and @SerializedName("stringValue")?

推荐答案

@SerializeName用于设置json对象将包含的密钥,但是@Expose用于确定是否将变量公开以进行序列化和反序列化,或不. 在这里 @Expose的文档.

@SerializeName is used to set the key that json object will include ,however @Expose is used to decide whether the variable will be exposed for Serialisation and Deserialisation ,or not. Here's the documentation of @Expose.

这篇关于Gson:@Expose与@SerializedName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆