How can I parse an json array in android looking like:
["BHUBANESWAR","BANGALORE CANT","BRAHMAPUR","VISAKHAPATNAM",
"VIJAYAWADA ROAD","ASOKHAR","CHAURAKHERI","BANIHAL","SADURA","ANANTNAG",
"PANJGAM","AWANTIPURA","KAKAPORA","PAMPORE"]
What I am trying is:
try {
JSONObject json = new JSONObject(s);
JSONArray jsonArray = json.names();
for ( int i = 0 ; i < jsonArray.length();i++)
{
Toast.makeText(getApplicationContext(),jsonArray.getInt(i),Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
But I am not getting any output.