jar的下载
maven方式
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.67</version>
</dependency>
jar包
百度云
链接:https://pan.baidu.com/s/1x_C4ii3OFMXbsoqikmZKGw
提取码:ku6z
示例
解析json数组
JSONObject jsonObject = JSON.parseObject(res.toString());
JSONArray jsonArray = jsonObject.getJSONArray("words_result");
Iterator<Object> iterator = jsonArray.iterator();
StringBuilder stringBuilder = new StringBuilder();
while (iterator.hasNext()) {
JSONObject object = (JSONObject) iterator.next();
stringBuilder.append(object.get("words"));
}