how to access the values of a json in java
<pre><code>[{
    "year": "2017",
    "org": "1",
    "sub_org": "",
    "sub_org_amt": ""
}, {
    "year": "2017",
    "org": "1",
    "sub_org": "",
    "sub_org_amt": ""
}]
</code></pre>

<p>This a sample data from my ajax request from :</p>

<pre><code>$.ajax({
    type: 'POST',
    url: 'add.jsp',
    dataType: "json",
    data: {
        action: action,
        tabledata: JSON.stringify(tabledata)
    },
    success: function(data) {


    },
    error: function(data) {
        console.log("error" + data);
    },
    beforeSend: function() {
    },
    complete: function() {
    }
})
</code></pre>

<p>How can i access each value in <code>add.jsp</code> so that i can insert them in database</p>

<p>I tried </p>

<pre><code>JSONParser parser = new JSONParser();
JSONObject json = (JSONObject) parser.parse(tabledata);
</code></pre>

<p>I have <code>import="net.sf.json.JSONObject"</code> but i get error in <code>JSONParser</code></p>

<p><code>UPDDATE</code></p>

<p>Added this line <code>import ="org.json.simple.parser.JSONParser"</code></p>

<p>But when i do <code>out.println("[" + json.toString() + "]");</code> nothing is shown</p>