I'm using JSONParser.java to show JSON data from a url
the url and the data are correct, they show some values of JSON (more than one)
but why this show only one value?
ArrayList<HashMap<String, String>> artikelList = new ArrayList<HashMap<String, String>>();
JSONParser jParser = new JSONParser();
JSONObject json = jParser.getJSONFromUrl(ArtikelURL);
try {
artikels = json.getJSONArray(TAG_ARTIKEL);
for(int i = 0; i < artikels.length(); i++){
JSONObject c = artikels.getJSONObject(i);
// Storing each json item in variable
String tanggal = c.getString(TAG_TGL);
String judul = c.getString(TAG_JUDUL);
String kutipan = c.getString(TAG_KUTIPAN);
HashMap<String, String> map = new HashMap<String, String>();
map.put(TAG_TGL, tanggal);
map.put(TAG_JUDUL, judul);
map.put(TAG_KUTIPAN, kutipan);
artikelList.add(map);
}
} catch (JSONException e) {
e.printStackTrace();
}
This is my JSON data:
{ "status":"1", "total":20, "artikel":[ { "tanggal":"2013-08-07", "judul":"Article One", "kutipan":"Example of article quote..." }, { "tanggal":"2013-07-23", "judul":"Article Two", "kutipan":"Example of article quote......" }, { "tanggal":"2013-07-22", "judul":"Article Three", "kutipan":"Example of article quote......" }, { "tanggal":"2013-03-16", "judul":"Article Four"", "kutipan":"Example of article quote,..." } ] }