Home:ALL Converter>Java jersey client consumes JsonArray of jsonArray

Java jersey client consumes JsonArray of jsonArray

Ask Time:2018-06-08T22:14:31         Author:Mirlo24X

Json Formatter

I have a special kind of parsing JSON url :


to do that i need to pass by a proxy and a jersey client :

URLConnectionClientHandler ch  = new URLConnectionClientHandler(new ConnectionFactory());
            Client client = new Client(ch);         
            WebResource resource = client.resource("https://api.xxxx");
            ExchangeRates[] responseMsg = resource.path("/openapi/xxxx").get(ExchangeRates[].class);

the response is :

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 is a list of ExchangeRate object. I can't find a way how to parse this json.Any recommandation ?

Author:Mirlo24X,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/50762603/java-jersey-client-consumes-jsonarray-of-jsonarray