标签:jar包 cti beanutils 1.0 com mob nbsp tis color
import java.util.HashMap; import java.util.Map; import net.sf.json.JSONObject; public class testJson { public static void main(String[] args) { testPingping(); } public static void testPingping(){ Map<String, String> smallMap = new HashMap<String, String>(); smallMap.put("userId", "438"); smallMap.put("name", "平平/萍萍"); smallMap.put("sex", "不知男女"); smallMap.put("reason", "和学成睡一晚,后来学成嘴疼"); JSONObject jsonObject = JSONObject.fromObject(smallMap); System.out.println("下面是专家开具的鉴定结果:"); //A joke System.out.println(jsonObject); System.out.println("患者鉴定完毕!"); //A joke System.out.println("下一位"); //A joke } }
也可以是Map<String, Object>类型
输出的结果:
下面是结果:
{"b_name":"平平/萍萍","d_reason":"和学成睡一晚,后来学成嘴疼","a_userId":"438","c_sex":"不知男女"}
--------------------------------------------------------------------------------------------------
需要引入的jar包列表:
cglib-nodep-2.2.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.1.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar
ezmorph-1.0.4.jar
gson-2.8.0-javadoc.jar
gson-2.8.0-sources.jar
gson-2.8.0.jar
jettison-1.3.1.jar
json-lib-2.2.1-jdk13.jar
json.jar
标签:jar包 cti beanutils 1.0 com mob nbsp tis color
原文地址:https://www.cnblogs.com/sunBinary/p/10244545.html