I am using import net.sf.json.JSONObject
My object is like this:
[{
"courseId": "AUTO_CAD",
"strDate": "02-04-2012"
}, {
"courseId": "CNC_PROG",
"strDate": "03-04-2012"
}]
Please help me how to access this in java service
//The code that i have tried.
List<JSONObject> jsonList = new ArrayList<JSONObject>();
jsonList = (List<JSONObject>) context.get("courseData"); // courseDate is my json object
JSONObject obj = jsonList.get(0);
Debug.log("courseStartDate ="+ obj.getJSONObject("courseId"));
//Using this gives me the following error. org.ofbiz.webapp.event.EventHandlerException: Service invocation error (java.lang.String cannot be cast to net.sf.json.JSONObject)