HashMap 转换成JSONObject 通过putAll() 可以实现HashMap转换成JSONObject。 HashMap<String,Object> problems = new HashMap<>(); problems.put("title","问题数量"); JSONObject jsonObject = new JSONObject(); jsonObject.putAll(problems); return jsonObject; 效果如下图所示: