[Solved] Why am I getting this error ?? java.lang.ClasscastException
The top level object in your JSON file is an array so: class letsRead { public static void main(String [] args) { String inline = “”; try { URL url = new URL(“https://gist.githubusercontent.com/anubhavshrimal/75f6183458db8c453306f93521e93d37/raw/f77e7598a8503f1f70528ae1cbf9f66755698a16/CountryCodes.json”); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod(“GET”); conn.connect(); int responsecode = conn.getResponseCode(); System.out.println(“Response code is: ” +responsecode); if(responsecode != 200) throw new RuntimeException(“HttpResponseCode: ” … Read more