把map转成json的步骤:1、需要一些jar包:json-lib-2.4-jdk15.jar、ezmorph-1.0.6.jar、commons-logging.jar、commons-lang.jar、commons-collections.jar、commons-beanutils.jar。2、把Map转换成json, 要使用jsonObject对象:Map<String, Object> map = new HashMap<String, Object>();map.put("userId", 1001);map.put("userName", "张三");map.put("userSex", "男");JSONObject jsonObject = JSONObject.fromObject(map);System.out.println(jsonObject);