Folks I am trying to populate a bean from a JSONOject but its throwing me the exception online 64:
“java.lang.ClassCastException: java.lang.String incompatible with net.sf.json.JSONObject
”
61: for( Object myObject : studentsGradeArray )
62: {
63:
64: JSONObject studentGradeJSON = (JSONObject) myObject;
What could be the possible reason for this?
It looks as though you are getting a
Stringobject instead of theJSONObjectthat you require. Assuming that all objects instudentsGradeArrayare supposed to be JSON Objects…More information can be found in the JSONObject documentation