我正在使用com.google.code.gson:gson:2.2.4
库使用代码将对象转换为 JSON:
String json = new GsonBuilder().excludeFieldsWithModifiers(Modifier.PROTECTED).create().toJson(object);
并且在 JSON 字符串中,“serialVersionUID”会自动添加Long
值,即使它不在模型类中。我只想serialVersionUID
从 JSON 中删除。