title: Parsing JSON data in C#
body: <p>I have a JSON data as follows</p>
  
  <pre><code> {"id": "367501354973","from": {
    "name": "Bret Taylor",
    "id": "220439"   }
  </code></pre>
  
  <p>which is returned by an object(result) of IDictionary[String, Object] </p>
  
  <p><em><strong>In my C# code:</em></strong></p>
  
  <p>I have made a <strong>class for storing the JSON value</strong> which is as follows</p>
  
  <pre><code>public class SContent
  {
      public string id { get; set; }
      public string from_name { get; set; }
      public string from_id { get; set; }
  }
  </code></pre>
  
  <p><strong>My main C# function which stores the parses the JSON data and stores the value inside the class properties</strong> is as follows:</p>
  
  <pre><code>List&lt;object&gt; data = (List&lt;object&gt;)result["data"];
              foreach (IDictionary&lt;string, object&gt; content in data)
              {
                  SContent s = new SContent();
  
                      s.id = (string)content["id"];
                      s.from_name = (string)content["from.name"];
                      s.from_id = (string)content["from.id"];
  
              }
  </code></pre>
  
  <p><em>When i execute this code, i get an exception saying <strong>System cannot find the Key "from.name" and "from.id"</em></strong></p>
  
  <p>When i <strong>comment</strong> the two lines (s.from_name = (string)content["from.name"];s.from_id = (string)content["from.id"];) <strong>my code runs fine.</strong></p>
  
  <p><strong>I think i am not able to refer the nested JSON data properly.</strong></p>
  
  <p><strong>Can anyone just validate it and please tell me how to refer nested data in JSON in C#?</strong></p>
  
  <p><strong>Thanks</strong></p>