本人没接触过json,java也是刚接触没多久,不过因为需要请大家帮忙解析下,自己弄了很久没成功。我想打印出来佘山两个字,谁能帮我用print方式写出来,顺便学习下,谢谢、
代码里面:
String json_res = results.getString("origin_result");
try {
JSONObject jo = new JSONObject(json_res);
print("--->origin_result=\n" + jo.toString(4)+("<-----"));
}
eclipse打印出来的结果是:
{
"content": {
"json_res": "{\"parsed_text\":\"我 要 去 佘山\",\"raw_text\":\"我要去佘山\",\"results\":[{\"demand\":0,\"domain\":\"map\",\"intent\":\"route\",\"object\":{\"arrival\":\"佘山\",\"route_type\":\"public\"},\"score\":1,\"update\":1}]}\n",
"item": [
"我要去佘山",
"我要去折衫",
"我要去蛇山",
"我要去畲山",
"我要去折山"
]
},
"result": {
"sn": "6a895c01-65db-4389-b3a5-99f83872c805",
"idx": -5,
"res_type": 3,
"corpus_no": 6174167756650349608,
"err_no": 0
}
}