You are using getString on "ID" when you should be using getInt. I tested the JSON string you provided in your question. The following code works:
java
String json =
"[{\"ID\":4,\"Name\":\"Vinoth\",\"Contact\":\"1111111111\",\"Msg\":\"1\"},{\"ID\":5,\"Name\":\"Mani\",\"Contact\":\"22222222\",\"Msg\":\"1\"},{\"ID\":6,\"Name\":\"Manoj\",\"Contact\":\"33333333333\",\"Msg\":\"1\"}]";
try {
JSONArray jsonArray = new JSONArray(json);
for (int i = 0, len = jsonArray.length(); i < len; i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
int id = jsonObject.getInt("ID");
String name = jsonObject.getString("Name");
String contact = jsonObject.getString("Contact");
String msg = jsonObject.getString("Msg");
System.out.println("id=" + id + ", name='" + name + "\', contact='" + contact + "\', msg='" + msg);
}
} catch (JSONException e) {
e.printStackTrace();
}
Output from running the above code:
id=4, name='Vinoth', contact='1111111111', msg='1
id=5, name='Mani', contact='22222222', msg='1
id=6, name='Manoj', contact='33333333333', msg='1
If you are still getting an error, post the stacktrace.