I have the below valid JSON and I need to loop through the results. I am using JSON.NET and c#. I am able to get the value for SUCCESS, but I do not know how to access Any guidance would be helpful.
{
"SUCCESS": 1,
"ERRMSG": "",
"COLUMNSANDDATA": {
"COLUMNS": ["LASTNAME", "FIRSTNAME", "EMAILADDRESS", "COURSENAME", "PROGRAMID",
"ENROLLMENTSTARTDATE", "COMPLETIONDATE", "GRADE", "SCORE",
"PASSED_NOTPASSED", "TYPEOFCREDITS", "CREDITSEARNED", "INSTRUCTORNAME",
"INSTRUCTOREMAILADDRESS", "CLIENTNAME", "COMMUNITYNAME",
"CERTIFICATESENTDATE", "DURATIONTYPE", "DURATIONMINUTES",
"LOGIN"],
"DATA": [
["Beane", "Coffee", "lynn@domain.com", "Program with One Essay Test", null,
"January, 06 2014 18:06:56", "January, 06 2014 18:57:53", "Incomplete", null,
"Not Passed", "Musical Note", 0.00, "Ray Bradbury", "lynn@domain.com",
"Hogarth's Flying Circus", "Captain's Club", null, null, null,
"lynn@domain.com"],
["Beane", "Navy", "lynn@domain.com", "Program with One Essay Test", null,
"January, 06 2014 18:06:56", "January, 06 2014 18:36:39", "Pass", 95.00,
"Passed", "Musical Note", 1.00, "Ray Bradbury", "lynn@domain.com",
"Hogarth's Flying Circus", "Captain's Club", "January, 06 2014 08:00:00",
null, null, "NavyB"]
]
}
}
I am able to get the SUCCESS Value by using this block of code
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
var deserializer = new JavaScriptSerializer();
var jsonObj = (IDictionary<string, object>)deserializer.DeserializeObject(result); ;
Response.Write((string)jsonObj["SUCCESS"]);
}