forum

Home / DeveloperSection / Forums / How to get the values from list of objects in c#

How to get the values from list of objects in c#

Manoj Bhatt 2556 26-Mar-2014

I have Called a Json Web Service and got the result in c#.The Json Web service data is available in format:

 {
  "Count": 9862,
  "Items": [
    {
      "Admin": {
        "S": "false"
      },
      "UserId": {
        "S": "e9633477-978e-4956-ab34-cc4b8bbe4adf"
      },
      "Age": {
        "N": "76.24807963806055"
      },
      "Promoted": {
        "S": "true"
      },
      "UserName": {
        "S": "e9633477"
      },
      "Registered": {
        "S": "true"
      }
    },
    {
      "Admin": {
        "S": "false"
      },
      "UserId": {
        "S": "acf3eff7-36d6-4c3f-81dd-76f3a8071bcf"
      },
      "Age": {
        "N": "64.79224276370684"
      },
      "Promoted": {
        "S": "true"
      },
      "UserName": {
        "S": "acf3eff7"
      },
      "Registered": {
        "S": "true"
      }
    },

I have got the Response like this in c#:

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:8000/userdetails");
        try
        {
            WebResponse response = request.GetResponse();
            using (Stream responseStream = response.GetResponseStream())
            {
                StreamReader reader = new StreamReader(responseStream, Encoding.UTF8);
                return reader.ReadToEnd();
            }
        }

after finally successfully get the response i have got all the Data in string. and then parse this string in list of objects .Now I have list of objects where it showing the count in debugging.Now I want to access the values like UserId:acf3eff7-36d6-4c3f-81dd-76f3a8071bcf like properties.I dont know how to do it.

Please help me and any help will be appreciated.


c# c# 
Updated on 26-Mar-2014

Can you answer this question?


Answer

1 Answers

Liked By