Getting Null Pointer exception JSON AJAX /Servlet Ajax post call which call the below servlet
$.ajax({
url: '/bin/commersenext/assetUpload',
type: 'POST',
contentType:'application/json',
data: JSON.stringify(ob),
dataType: 'json',
success:function(msg){
alert("data"+msg);
console.log(msg);
}
});
Servlet Code - where nullpointerexception occurred:
JSONParser parser = new JSONParser();
JSONArray jsonArray = null;
String tabledata = request.getParameter("data");
try{
Object obj = parser.parse(tabledata);
JSONArray array = (JSONArray)obj;
System.out.println(array.get(1));