Google Json arraylist 返回 0 值

Google Json arraylist returning 0 value

我的 Google Json arrylist 是 return 0 值,但不应该。

我不想要 return 这个值,例如:

this--"total":0,"records":0,"page":0,"rows":0,

下面的代码 return 这个数组:

[  
  {  
    "message":"sdfghjkl",
    "total":0,
    "records":0,
    "page":0,
    "rows":0
  },
  {  
    "message":"knee problem",
    "total":0,
    "records":0,
    "page":0,
    "rows":0
  },
  {  
    "message":"hip problem",
    "total":0,
    "records":0,
    "page":0,
    "rows":0
  },
  {  
    "message":"patient message",
    "total":0,
    "records":0,
    "page":0,
    "rows":0
  },
  {  
    "message":"hip problem 2-12-2015",
    "total":0,
    "records":0,
    "page":0,
    "rows":0
  },
  {  
    "message":"hip problem 12-2015",
    "total":0,
    "records":0,
    "page":0,
    "rows":0
  }
]

代码:

Gson gson = new Gson();
List<PatientDto> all_pati_message = new ArrayList<PatientDto>();
String sql = "";
try {

  sql = "SELECT message from patient_mess";

  ResultSet rs;
  rs = DatabaseConn.getConnection().createStatement().executeQuery(sql);
  while (rs.next()) {
    PatientDto dto1 = new PatientDto();
    dto1.setMessage(rs.getString(1));
    all_pati_message.add(dto1);
  }
} catch (Exception e) {
  e.printStackTrace();
}
String jsonString = gson.toJson(all_pati_message);
return jsonString;    

      GsonBuilder builder = new GsonBuilder();
        builder.excludeFieldsWithoutExposeAnnotation();
        final Gson gson = builder.create();

and use annotation of google json like @Expose private String message, in your dto class PatientDto