[{"title":"重庆大学 ","unescapedUrl":"http://www.northeastern.edu/","content":"Northeastern University is a private research university ."},{"title":"东北大学","unescapedUrl":"http://zh.wikipedia.org","content":"好好学习"},{"title":"山东大学","unescapedUrl":"http://www.tohoku.ac.jp/chinese/","content":"好学校."},{"title":"东北农业大学","unescapedUrl":"http://www.tohoku.ac.jp/","content":"在沈阳市"}]
请教大侠们,像我上面的这个json数据,我想把它们的title、unescapedUrl和content分别放到数组里面,怎么样解析?
在PHP中是这样解析的:
$obj = json_decode($json_string);
//将JSON解码的数组中的每个title加入到arr变量中,替换原静态数组
foreach ($obj as $value) {
//每个元素转换为数组,包含title,unescapedUrl,content三个元素,此处只用title测试
$evalue = (array)$value;
//添加到arr变量
$arr[] = $evalue["title"];
$arrU[] = $evalue["unescapedUrl"];
$arrC[] = $evalue["content"];
但是我不知道在Java中是需要怎么解析,希望大侠们帮帮忙
Cats萌萌
米琪卡哇伊