<!--json数组,字符串转换-->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
使用:
JSONArray array = JSONArray.fromObject("JSON数组字符串");
JSONObject jsonObject = JSONObject.fromObject("JSON格式字符串");
如:
{ "type":2, "name":"222", "content":{ "title":"222", "list":[ {"title":"222","content":"222"}, {"title":"222","content":"22222\n33333\n44444"} ]} }