java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.JSONArray

Viewed 24440

I need to read a JsonArray data from a file (on an SD card) and store it into a SQLite database.

but I am getting a java.lang.ClassCastException: org.json.simple.JSONArray cannot be cast to org.json.JSONArray exception while parsing data to JsonArray.

Data in the file is very huge, the whole data can not be stored in a single String or String Buffer or String Builder.

Here is my code.

FileReader fileReader = new FileReader(file_path);
Object obj = jsonParser.parse(fileReader);
JSONArray jsonArray = (JSONArray) obj; // Exception.

Please help..

2 Answers
Related