我如何分析一個JSON數組來獲取數據,而[]和 「」的Android解析JSON陣列
這裏是JSON
"formattedAddress": [
"23, Damansara - Puchong Hwy (Bandar Puchong Jaya)",
"47100 Puchong Batu Dua Belas, Selangor",
"Malaysia"
]
我的代碼:
poi.setFormattedAddress(jsonArray.getJSONObject(i).getJSONObject("location").getJSONArray("formattedAddress").toString());
輸出: [「23,白沙羅 - 蒲種高速公路(蒲種高速公路)」,「47100 Puchong Batu Dua Belas,Selangor」,「馬來西亞」]
我只想要數據。如:
23,白沙羅 - 蒲種高速公路(新華社蒲種再也),47100個蒲種巴圖杜阿貝拉斯,馬來西亞雪蘭莪州
感謝
可能是你的JSON數組是不正確的。請檢查此鏈接http://www.tutorialspoint.com/android/android_json_parser.htm – Pavya 2015-01-21 03:58:13
是的,我認爲你的JSON是不正確的。 – eLemEnt 2015-01-21 04:03:34
嘗試讀取數據作爲字符串數組。字符串[] – toidiu 2015-01-21 04:06:38