版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/LucasXu01/article/details/84798666
若是JSON中定义的字段名使用了Java中的关键字,不准许在JavaBean中定义,可以使用@SerializedName注解:
@SerializedName(“switch”)
private String myswitch;
@SerializedName(“app_version_code”)
private int versionCode;
说明:JSON字符串中的字段switch对应Javabean中的字段myswitch
亦有其他解决方案:https://blog.csdn.net/zml_2015/article/details/53994902