Java fastjson解析json字符串实现过程解析
陈彦斌 人气:0jar的下载
maven方式
<dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.67</version> </dependency>
jar包
百度云链接:http://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")); }
加载全部内容