title: JSON Object to properties
body: <p>I want to store the results from JSON in properties, but I don't know how. I'm using ASP.NET with MVC 4/Razor.</p>
  
  <p>My model's constructor is:</p>
  
  <pre><code>    public UserModel()
      {
          WebClient request = new WebClient();
          string response = request.DownloadString(url);
  
          JObject _naturalUserObject = (JObject)JsonConvert.DeserializeObject(response);
      }
  </code></pre>
  
  <p>And I have the follow properties:</p>
  
  <pre><code>    [Key]
      public int Id { get; set; }
  
      public int DisplayName { get; set; }
      public int Avatar { get; set; }
  </code></pre>
  
  <p>To access a simple value from my JSON:</p>
  
  <pre><code>_naturalUserObject["users"][0]["name"];
  </code></pre>
  
  <p>The final question is: how can I store each value from my JObject in my model's properties and finally display it into my view?</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>/EDIT/</strong>
  My model now is:</p>
  
  <pre><code>    public UserModel()
      {
          WebClient request = new WebClient();
          string response = request.DownloadString(String.Format("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key={0}&amp;steamids={1}", ConfigurationManager.AppSettings["SteamApiKey"].ToString(), HttpContext.Current.Request.Cookies["SteamIdCookie"].Value));
  
          string _naturalUserObject = JsonConvert.DeserializeObject&lt;string&gt;(response);
      }
  </code></pre>
  
  <p>And one of my property is:</p>
  
  <pre><code>    private string _avatar;
      public string Avatar
      {
          get { return _avatar; }
          set { _avatar = _naturalUserObject["response"]["players"][0]["avatar"]; }
      }
  </code></pre>
  
  <p>But without success. =(</p>