今日在做Springboot时把请求放在后端进行,请求返回的结果的字符串需转化为JSON格式才能在后端进行交互,转换时遇到没有的问题,![](https://i-blog.csdnimg.cn/blog_migrate/7942325f2045f62c878a5c950653c627.png)
找寻后发现应该导入相关依赖包才能使用JSONObject
import net.sf.json.JSONObject;
net.sf.json.JSONObject依赖
<!-- JSONObject对象依赖的jar包 -->
<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