title: WebClient to consuming JSON and send their values for properties
body: <p>I "founded" a really good online tool to create a C# class to me (<a href="http://json2csharp.com/" rel="nofollow">http://json2csharp.com/</a>), but now I need to create a WebClient that consume the JSON and populate the properties with their respective values.</p>
  
  <p>Actually I already have tried to make my own WebClient, but I don't know how to implement him to the generated code from JSON2Csharp.</p>
  
  <p>The JSON2CSharp code:</p>
  
  <pre><code> public class UserModel 
   {
      public int communityvisibilitystate { get; set; }
      public int profilestate { get; set; }
      public string personaname { get; set; }
      public int lastlogoff { get; set; }
      public string profileurl { get; set; }
      public string avatar { get; set; }
      public string avatarmedium { get; set; }
      public string avatarfull { get; set; }
      public int personastate { get; set; }
  }
  
  public class Response
  {
      public List&lt;UserModel&gt; users { get; set; }
  }
  
  public class RootObject
  {
      public Response response { get; set; }
  }
  </code></pre>
  
  <p>Now, I've tried to do this with the UserModel's class:</p>
  
  <pre><code>public class UserModel
  {
      public UserModel()
      {
          WebClient request = new WebClient();
          var response = request.DownloadString(url);
  
          JsonConvert.PopulateObject(response, this);
      }
  
      ...
  }
  </code></pre>
  
  <p>But without success (as it was expected). So I ask: what can I do to make my WebClient compatible with the JSON2Csharp's code?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>==== UPDATE ====</strong></p>
  
  <p>My view:</p>
  
  <pre><code>@model DotaMix.Models.UserModel
  @{
     ViewBag.Title = @Model.personaname;
  }
  </code></pre>
  
  <p>The problem: the title is invisible.</p>
  
  <p><strong>==== UPDATE ====</strong></p>
  
  <p>My full model's code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.ComponentModel.DataAnnotations;
  using System.ComponentModel.DataAnnotations.Schema;
  using System.Data.Entity;
  using System.Globalization;
  using System.Web;
  using System.Web.Security;
  using System.Net;
  using System.Configuration;
  using System.IO;
  using System.Runtime.Serialization.Json;
  using System.Text;
  using Newtonsoft.Json;
  using Newtonsoft.Json.Linq;
  using ServiceStack.Text;
  
  namespace Mix.Models
  {
      public class UserModel
      {
          public UserModel()
          {
              WebClient request = new WebClient();
              var response = request.DownloadString(url);
  
              JsonConvert.PopulateObject(response, this);
          }
  
          public string steamid { get; set; }
          public int communityvisibilitystate { get; set; }
          public int profilestate { get; set; }
          public string personaname { get; set; }
          public int lastlogoff { get; set; }
          public string profileurl { get; set; }
          public string avatar { get; set; }
          public string avatarmedium { get; set; }
          public string avatarfull { get; set; }
          public int personastate { get; set; }
      }
  
      public class Response
      {
          public List&lt;UserModel&gt; users { get; set; }
      }
  
      public class RootObject
      {
          public Response response { get; set; }
      }
  }
  </code></pre>