I am new to jQuery, Ajax and JSON. I ran into a Json parsing problem. I went through a lot of questions about stackoverflow
Parsing JSON objects for an HTML table
Access / process (nested) objects, arrays or JSON
JSON parsing in JavaScript?
How can I parse this JSON object in jQuery?
and much more...
However, I cannot parse Json data.
My jquery looks like:
$.ajax({ url : "launchapptest", data : "processDateInput="+processDate, dataType : "json", async: true, success : function(result) { var od = JSON.stringify(result) ; var obj = JSON.parse(od); console.log(obj.od); console.log(obj.od.percentageCompleted); console.log(od); $.each(JSON.parse(od), function(idx, obj) { console.log(obj.tagName); }); } });
I tried all combinations to analyze this data, but the js console prints as "undefined"
I can print the json object as:
{ "od": [ { "dateProcessed": [ "09/11/2014", "10/11/2014", "11/11/2014", "12/11/2014" ], "percentageCompleted": 25, "processRunning": 0, "remainingTime": 0, "successBatchCount": 0, "totalBatchCount": 0 } ], "processDateInput": "12/11/2014" }
Please help me how can I get a dateProcessed array and the percentage is complete.