你好,大家好我正在閱讀一個網頁,包含具有JAVA(安卓)JSON對象使用JSON訪問特定的屬性
下面是該頁面包含:
{
"destination_addresses" : [ "Safi, Maroc" ],
"origin_addresses" : [ "Avenue Hassan II, Safi, Maroc" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "1,0 km",
"value" : 966
},
"duration" : {
"text" : "2 minutes",
"value" : 129
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
我知道如何閱讀從這樣
JSONObject jArray = new JSONObject(result);
String elements = jArray.getString("rows");
元素串的頁面包含:
[{"elements" : [{"distance" : {"text" : "1,0 km","value" : 966},"duration" : {"text" : "2 minutes","value" : 129},"status" : "OK"}]}]
但是我試圖讓距離值這是 「」
THX傢伙
是這項工作,TY – Coldfire