我正在尝试从此链接中阅读以下输入: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,...
我需要提取“TradePairId”,我可以通过用逗号分割获取的字符串并将其放入列表来实现这一点,但由于它是带有list.get的一维列表,这将是一个丑陋的解决方案( 2)正在
""Data":{"TradePairId":5203"
我如何能够干净利落地分析整个1行列表中的另一个列表,并以“正确”的方式访问它的内容?
到目前为止,我所拥有的是以下内容(这种丑陋的方式并不完整地读取整个数据):
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(","));