0

I have the following code and i need to use it inside a List<>. Can someone help me on this?

    protected void Page_Load(object sender, EventArgs e)
    {

        string url = "http://localhost:52148/api/federateds";

        using (var w = new WebClient())
        {
            var json_data = string.Empty;
            try
            {
                json_data = w.DownloadString(url);
            }
            catch (Exception) { }
        }

        List<federateds> federados = new ????;

    }
trashgod
  • 200,320
  • 28
  • 229
  • 974
  • 5
    Already answered - http://stackoverflow.com/questions/22191167/convert-json-string-to-c-sharp-object-list – AsafSavich Mar 03 '16 at 12:20

1 Answers1

0

You should try JSON frameworks, like Json.NET

With it your code would look like

List<federateds> federados = JsonConvert.DeserializeObject<List<federateds>>(json_data);
Toddams
  • 1,430
  • 15
  • 21