I am trying to get the data from the below JSON output. I am unable to get the data using the below mentioned java code. Could you please help me to correct my code ?
[
{
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
}
]
Code
public void loadAltCoins(String result) {
try {
JSONObject reader = new JSONObject(result);
JSONArray jArray = new JSONArray(reader);
for (int i = 0; i < jArray.length(); i++) {
json_data = jArray.getJSONObject(i);
System.out.println("Testing ID : " + json_data.getString("id"));
}
}