{{theTime}}

Search This Blog

Total Pageviews

Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to

Exception in thread "main" java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.simple.JSONObject
at com.util.ReadJSONFile.main(ReadJSONFile.java:19)

Hint:

Verify the JSON input file to find out the referred text in Java is an Object or an Array.

Example:  If phoneNumbers in JSON file is an array,  casting array to an Object throws above exception.

Change the code to cast to JSONArray.  

JSONArray ja = (JSONArray) jo.get("phoneNumbers");

No comments:

Could not find method signingConfigs() for arguments

Could not find method signingConfigs() for arguments [build_5dw7nwfc8ibd8sagvx4p79x1u$_run_closure5@13e86039] on root project 'android&#...