Quote Originariamente inviata da andbin Visualizza il messaggio
Il punto è che quella response non è un "array" JSON .... è un "object".
ciao andbin!

ok, immaginavo.
però se faccio così:
codice:
public class Main {

    public static void main(String[] args) {
        try {
            String strUrl = "https://httpbin.org/get";
            HttpClient client = HttpClientBuilder.create().build();
            HttpGet request = new HttpGet(strUrl);
            HttpResponse response = client.execute(request);
            JSONObject obj = new JSONObject(response.getEntity().getContent().toString());
            System.out.println(obj.toString());           
        } catch (IOException ex) {
            System.out.println(ex.getMessage());
        }
    }

}
ottengo:
codice:
Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
    at org.json.JSONTokener.syntaxError(JSONTokener.java:451)
    at org.json.JSONObject.<init>(JSONObject.java:195)
    at org.json.JSONObject.<init>(JSONObject.java:319)
    at com.mp.testmaven.Main.main(Main.java:21)
-----------------------------------------------------------