我有一种特殊的解析JSON url:
[{"exchangeRates":[{"currencyISO":"AUD","currencyShortName":"dolar"}]}]
要做到这一点,我需要通过代理和泽西客户端传递:
URLConnectionClientHandler ch = new URLConnectionClientHandler(new ConnectionFactory());
Client client = new Client(ch);
WebResource resource = client.resource("https://api.xxxx");
resource.type(MediaType.APPLICATION_JSON);
ExchangeRates[] responseMsg = resource.path("/openapi/xxxx").get(ExchangeRates[].class);
回复是:
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.xxx.ExchangeRates out of START_ARRAY token at [Source: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@236cfcf; line: 1, column: 1]
ExchangeRates是ExchangeRate对象的列表。 我无法找到解决这个json的方法。任何推荐?