My ajax passed a json array that looks like this:
{"formData":[{"cusID":"2"},{"empID":"1"}],"invoice":578416969}
I am trying to get the data using javax.json library.
JSONObject jsonObj = new JSONObject(jasonString);
I am able to grab the value of invoice:
Integer invoiceNum = (Integer) jsonObj.get("invoice");
But I am unable to grab the value of cusID and empID, by doing the following:
Integer cusId = Integer.parseInt((String) jsonObj.get("cusID"));
Integer empId = Integer.parseInt((String) jsonObj.get("empID"));
Error message:org.json.JSONException: JSONObject["cusID"] not found.
What did I do wrong? I am open to suggestions,if you have a better way of handling this json data, I am willing to use it.