一、
HashMap<String, String> Contentmap = new HashMap<>();
Contentmap.put("title", Title);
Contentmap.put("departmentId", DepartID+"");
Contentmap.put("disease", Disease);
Contentmap.put("detail", Coent);
Gson gson = new Gson();
String str = gson.toJson(Contentmap);
//str就是json格式
二、
try {
JSONObject ClientKey = new JSONObject();
ClientKey.put("title", Title);
ClientKey.put("departmentId", DepartID);
ClientKey.put("disease", Disease);
ClientKey.put("detail", Coent);
String params=String.valueOf(ClientKey);
//params就是json格式
} catch (Exception e) {
e.printStackTrace();
}