使用Map<String, String>
来接收
Gson gson = new Gson();
String json;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(request.getInputStream(), "utf-8"));
StringBuffer sb = new StringBuffer("");
String temp;
while ((temp = br.readLine()) != null) {
sb.append(temp);
}
br.close();
json = sb.toString();
Map<String, String> result = gson.fromJson(json, new TypeToken<Map<String, String>>(){}.getType());
System.out.println(result.get("name"));
System.out.println(result.get("id"));
} catch (Exception e) {
e.printStackTrace();
}