How to read an array of JSON objects sent from ajax in java servlet
<p>This is my code:</p>

<pre><code>json = JSON.stringify(jsonObj);

$.ajax({
    type: 'post', 
    url: 'PostStudentMarks',
    async: false,
    data: json, 
    contentType: "application/json",
    dataType: 'json',
    success: function (response) {
        alert("Marks Uploaded");
    },
    error: function(err) {
        console.log(arguments);
    }
});
</code></pre>

<p><code>jsonObj</code> contains data like this </p>

<pre><code>[{
    "student_id": "11204172"
},{
    "course_id": "PHY101",
    "semester": "1",
    "marks": "11"
},{
    "course_id": "CSE401",    
    "semester": "2",
    "marks": "22"
}]
</code></pre>

<p>What should be the proper Java code in the servlet to read and iterate through it?Currently I am using <code>org.json.simple</code>. Moreover if I do like </p>

<pre><code>JSONObject jsonObject = new JSONObject(request.getParameter("json"));
JSONArray json = new JSONArray(jsonObject);
</code></pre>

<p>It throws an error saying <code>undefined constructor</code>. What is the proper solution for this? Also note that I do not want to use gson.</p>