この形式の BBC からの json フィードがあります
{
"name": "ticker",
"entries": [
{
"headline": "text",
"prompt": "LATEST",
"isBreaking": "false",
"mediaType": "Standard",
"url": ""
},
{
"headline": "text",
"prompt": "LATEST",
"isBreaking": "false",
"mediaType": "Standard",
"url": ""
},
etc...........
私のコードは次のとおりです。
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
JSONObject json = JSONfunctions.getJSONfromURL("http:/......");
try{
JSONArray item = json.getJSONArray("entries");
for (int i = 0; i<item.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
JSONObject e = item.getJSONObject(i);
JSONObject title = e.JSONObject("headline");
map.put("title", "Title:" + e.getString("headline");
}
}
それは私にエラーを与える"java.lang.String cannot be converted to JSONObject"
私も除外しようとしJSONObject title = e.JSONObject("headline");
ましたが、パスエラーが発生します(注