Home > DeveloperSection > Forums > How to parse JSON Array using Newtonsoft?
Monaj Singh
Monaj Singh

Total Post:41

Posted on    January-19-2015 10:27 PM

 ASP.Net JSON  Json.net  Array 

 1 Reply(s)
 722  View(s)
Rate this:

I'm working on a project in which I want to deserialize a JSON Array. I have tried but didn't get how to parse it.



Here is the JSON which I get from the WebService:

How I Tried:

    string URL = "http://localhost:32319/ServiceEmployeeLogin.svc/getattendance";

    WebRequest wrGETURL;

    wrGETURL = WebRequest.Create(URL + "/" + Server.UrlEncode("24-06-2014"));

    wrGETURL.Method = "POST";

    wrGETURL.ContentType = @"application/json; charset=utf-8";

    HttpWebResponse webresponse = wrGETURL.GetResponse() as HttpWebResponse;


    Encoding enc = System.Text.Encoding.GetEncoding("utf-8");

    // read response stream from response object

    StreamReader loResponseStream = new StreamReader(webresponse.GetResponseStream(), enc);


    // read string from stream data

    strResult = loResponseStream.ReadToEnd();

    // close the stream object


    // close the response object



    RootObject ro = JsonConvert.DeserializeObject<RootObject>(strResult);


    //what to do now?




public class ShowAttendanceResult


    public string lec_no { get; set; }

    public string reg_no { get; set; }

    public string std_status { get; set; }

    public string std_username { get; set; }



public class RootObject


    public List<ShowAttendanceResult> showAttendanceResult { get; set; }


Ashish Pandey

Total Post:128

Posted on    January-19-2015 11:45 PM

RootObject ro = JsonConvert.DeserializeObject<RootObject>(strResult);


foreach(var item in ro.showAttendanceResult)


    string _name= item.lec_no;


Don't want to miss updates? Please click the below button!

Follow MindStick