I am trying to read the following input from this link: https://www.cryptopia.co.nz/api/GetMarket/ETH_BTC
{"Success":true,"Message":null,"Data":{"TradePairId":5203,"Label":"ETH/BTC","AskPrice":0.05711848,"BidPrice":0.05703892,"Low":0.05500000,"High":0.05733556,"Volume":1243.83039158,...
I need to extract the "TradePairId", and I could do this by splitting the fetched string with commas and putting that into a list, but this would be an ugly solution due to it being a 1D list with list.get(2) being
""Data":{"TradePairId":5203"
How could I analyze this entire 1 line list with another list inside of it cleanly and in the "right" way to access it's contents?
So far all I have is the following (the ugly way that isn't exactly reading the entire data as it should be):
URL tickerHistory = new URL("https://www.cryptopia.co.nz/api/GetMarket/" + currencyPair.toString());
URLConnection yc = tickerHistory.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
String inputLine = in.readLine();
List<String> tempList = Arrays.asList(inputLine.split(","));