JSONObject依赖包
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.28</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
<!-- JSONObject.fromObject()的依赖, JSONArray.fromObject() -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<!-- JSONObject依赖包 -->
要想实现JSON和java对象之间的互转,需要借助第三方jar包,这里使用json-lib这个jar包,下载地址为:https://sourceforge.net/projects/json-lib/,json-lib需要commons-beanutils-1.8.0.jar、commons-collections-3.2.1.jar、commons-lang-2.5.jar、commons-logging-1.1.1.jar、ezmorph-1.0.6.jar五个包的支持,可以自行从网上下载
json-lib提供了几个类可以完成此功能,例,JSONObject、JSONArray。从类的名字上可以看出JSONObject转化的应该是对象格式的,而JSONArray转化的则应该是数组对象(即,带[]形式)的。
标签:依赖,lib,JsonObject,jar,commons,json,collections,net From: https://www.cnblogs.com/zhaostudy/p/16719073.html