最近使用
JSONObject.fromObject(jsonAStr)这个方法转换对象
必须引用的包为net.sf.json.JSONObject,而引用包的过程中很容易出错,在此贴一下jar包依赖。
注意:最关键的net.sf.json-lib这个依赖里面必须是jdk15,具体原因目前不清楚,先用着吧,回头仔细研究。
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</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>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier><!-- jdk版本 -->
</dependency>
来源:CSDN
作者:qq_41611829
链接:https://blog.csdn.net/qq_41611829/article/details/104742831