解决JSONObject类找不到的问题

导致该问题的原因顾明思议就是该类没有找到,表面上看是没有导入相应的jar包,但往往遇到的问题是包的冲突问题,和包的依赖不全问题

1、包的版本问题


    net.sf.json-lib
    json-lib
    2.4
    jdk15
需要制定jdk的版本,jdk15表示jdk1.5,同时要查看本地是否导入别的版本json-lib,有的话移除掉

2、包的依赖没有导入全,以下的包要一起导入
<dependency>
    <groupId>commons-langgroupId>
    <artifactId>commons-langartifactId>
    <version>2.6version>
dependency>
<dependency>
    <groupId>commons-httpclientgroupId>
    <artifactId>commons-httpclientartifactId>
    <version>3.1version>
dependency>
<dependency>
    <groupId>commons-beanutilsgroupId>
    <artifactId>commons-beanutilsartifactId>
    <version>1.8.3version>
dependency>
<dependency>
    <groupId>commons-collectionsgroupId>
    <artifactId>commons-collectionsartifactId>
    <version>3.2version>
dependency>
<dependency>
    <groupId>commons-logginggroupId>
    <artifactId>commons-loggingartifactId>
    <version>1.1.1version>
dependency>
<dependency>
    <groupId>net.sf.ezmorphgroupId>
    <artifactId>ezmorphartifactId>
    <version>1.0.6version>
dependency>
<dependency> <groupId>net.sf.json-libgroupId> <artifactId>json-lib-ext-springartifactId> <version>1.0.2version>dependency>
3、Jackson可以轻松的将Java对象转换成json对象和xml文档,同样也可以将json、xml转换成Java对象,依赖如下:

<dependency>
    <groupId>org.codehaus.jacksongroupId>
    <artifactId>jackson-core-aslartifactId>
    <version>1.9.13version>
dependency>
<dependency>
    <groupId>org.codehaus.jacksongroupId>
    <artifactId>jackson-mapper-aslartifactId>
    <version>1.9.13version>
dependency>

https://blog.csdn.net/hangdianyizhihua/article/details/46965653

侵删http://www.yikongyin.com/

你可能感兴趣的:(知识复习,java,json)