我有以下 JSON 响应:
{
"destination_addresses" : [ "Berlin, Deutschland" ],
"origin_addresses" : [ "Mannheim, Deutschland" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "624 km",
"value" : 624195
},
"duration" : {
"text" : "5 Stunden, 53 Minuten",
"value" : 21156
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
我的问题是:如何访问“距离”部分中的“文本”元素?
我现在有以下内容:
JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
JSONArray rows= null;
rows= object.getJSONArray("rows");