title: How can I deserialize JSON in C#?
body: <p>Can somebody help me with the proper way to deserialize json in this format:</p>
  
  <pre><code>[
      {person: {name: "James", age:26}},
      {person: {name: "Mary", age:36}},
      {person: {name: "Kofi", age:46}}
  ]
  </code></pre>
  
  <p>The code I'm using is below:</p>
  
  <pre><code>WebRequest request = WebRequest.Create("url");
  WebResponse response = request.GetResponse();
  
  string json;
  
  using (var sr = new StreamReader(response.GetResponseStream()))
  {
      json = sr.ReadToEnd();
  }
  
  var serializer = new JavaScriptSerializer();
  
  var persons= serializer.Deserialize&lt;List&lt;response&gt;&gt;(json);
  
  foreach (var item in persons)
  {
      Console.Write("name:" + item.name + " and age: " + item.age);
  }
  </code></pre>
  
  <p>The class I'm mapping to is below:</p>
  
  <pre><code>public class person
  {
      public string name{get;set;}
      public int age{get; set;}
  }
  
  public class response
  {
     public person person {get;set;}
  }
  </code></pre>
  
  <p>I keep getting nulls and empty strings for the name and age properties when I run this code. I would appreciate it a lot if someone could help me out.</p>