i have understood how to get a JSON Array. but i dont know how to get here is the link to the JSON file. https://www.cryptocompare.com/api/data/coinlist
or
{
"Response": "Success",
"Message": "Coin list succesfully returned!",
"BaseImageUrl": "https://www.cryptocompare.com",
"BaseLinkUrl": "https://www.cryptocompare.com",
"DefaultWatchlist": {
"CoinIs": "1182,7605,5038,24854,3807,3808,202330,5324,5031,178978",
"Sponsored": "1182"
},
"Data": {
"USC": {
"Id": "100954",
"Url": "/coins/usc/overview",
"ImageUrl": "/media/1383363/usc.png",
"Name": "USC",
"Symbol": "USC",
"CoinName": "Ultimate Secure Cash",
"FullName": "Ultimate Secure Cash (USC)",
"Algorithm": "SHA256",
"ProofType": "PoS",
"FullyPremined": "0",
"TotalCoinSupply": "200084200",
"PreMinedValue": "N/A",
"TotalCoinsFreeFloat": "N/A",
"SortOrder": "1233",
"Sponsored": false
},
"DUX": {
"Id": "105206",
"Url": "/coins/dux/overview",
"ImageUrl": "/media/1383364/dux.png",
"Name": "DUX",
"Symbol": "DUX",
"CoinName": "DuxCoin",
"FullName": "DuxCoin (DUX)",
"Algorithm": "Scrypt",
"ProofType": "PoW/PoS",
"FullyPremined": "0",
"TotalCoinSupply": "1680000000",
"PreMinedValue": "N/A",
"TotalCoinsFreeFloat": "N/A",
"SortOrder": "1234",
"Sponsored": false
},
"XPS": {
"Id": "105220",
"Url": "/coins/xps/overview",
"ImageUrl": "/media/1383365/xps.png",
"Name": "XPS",
"Symbol": "XPS",
"CoinName": "PoisonIvyCoin",
"FullName": "PoisonIvyCoin (XPS)",
"Algorithm": "Scrypt",
"ProofType": "PoW/PoS",
"FullyPremined": "0",
"TotalCoinSupply": "4666666667",
"PreMinedValue": "N/A",
"TotalCoinsFreeFloat": "N/A",
"SortOrder": "1235",
"Sponsored": false
},
"EQT": {
"Id": "105263",
"Url": "/coins/eqt/overview",
"ImageUrl": "/media/1383366/eqt.png",
"Name": "EQT",
"Symbol": "EQT",
"CoinName": "EquiTrader",
"FullName": "EquiTrader (EQT)",
"Algorithm": "Scrypt",
"ProofType": "PoW",
"FullyPremined": "0",
"TotalCoinSupply": "72000000",
"PreMinedValue": "N/A",
"TotalCoinsFreeFloat": "N/A",
"SortOrder": "1236",
"Sponsored": false
},
"INSN": {
"Id": "105284",
"Url": "/coins/insn/overview",
"ImageUrl": "/media/1383366/insn.png",
"Name": "INSN",
"Symbol": "INSN",
"CoinName": "Insane Coin",
"FullName": "Insane Coin (INSN)",
"Algorithm": "X11",
"ProofType": "PoW/PoS",
"FullyPremined": "0",
"TotalCoinSupply": "30000000",
"PreMinedValue": "N/A",
"TotalCoinsFreeFloat": "N/A",
"SortOrder": "1237",
"Sponsored": false
}
},
"Type": 100
}
Symbol,
FullName and
CoinName this is my code
try {
// Hashmap for ListView
ArrayList<HashMap<String, String>> PriceList = new ArrayList<HashMap<String, String>>();
JSONObject jsonObj = new JSONObject(json);
JSONObject mJ = jsonObj.getJSONObject("Response");
for (int i = 0; i < json.length(); i++) {
JSONObject c = mJ.getJSONObject("Data");
String symbol = c.getString("Symbol");
String fName = c.getString("FullName");
String cName = c.getString("CoinName");
// tmp hashmap for single data
HashMap<String, String> data = new HashMap<>();
// adding each child node to HashMap key => value
data.put("Symbol",symbol);
data.put("FullName",fName);
data.put("CoinName",cName);
// adding data to listView
PriceList.add(data);
}
return PriceList;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
} else {
Log.e("ServiceHandler", "Couldn't get any data from the url");
return null;
}
See Question&Answers more detail:
os