title: Parse JSON results - C#
body: <p>Thanks in advance for any assistance!</p>
  
  <p>OK, so I'm trying to parse a Json result from an API and I'm by no means a Json expert, but the returned result of the data seems a bit difficult for me to grasp (It appears to return a 'header' and then the items...see raw result example).  I've been trying to parse this using Json.NET <a href="http://james.newtonking.com/projects/json/help/" rel="nofollow">http://james.newtonking.com/projects/json/help/</a> (which seems like a pretty great tool, just not familiar with it enough yet, or Json for that matter).  </p>
  
  <p>What I'm looking for is maybe someone with experience using this particular dll or recommendations for a better/easier tool?  (I'm trying to parse the results to ideally map to a class).</p>
  
  <p>-Thanks</p>
  
  <h2>Raw Returned Result (Json)</h2>
  
  <pre><code>{
  "code": 0,
  "message": "Successful",
  "partials": {
      "_key": "partial",
      "0": {
          "datetime": "2011-03-08 16:22:51",
          "customer_id": "373263",
          "domain": "xyz.com ** deleted 2011-04-08 18:26:55 UTC**",
          "name": "Joe Customer",
          "phone": "1234567894",
          "email": "joecustomer@test.com",
          "offer": "",
          "pub_id": "",
          "sub_id": "",
          "data1": "",
          "data2": "",
          "data3": "",
          "custom1": "",
          "custom2": "",
          "custom3": "",
          "custom4": "",
          "custom5": "",
          "custom6": "",
          "custom7": "",
          "custom8": "" 
      },
      "1": {
          "datetime": "2011-03-08 16:43:11",
          "customer_id": "373296",
          "domain": "abc.com ** deleted 2011-04-08 18:26:55 UTC**",
          "name": "Jane Customer",
          "phone": "1234567891",
          "email": "janecustomer@test.com",
          "offer": "",
          "pub_id": "",
          "sub_id": "",
          "data1": "",
          "data2": "",
          "data3": "",
          "custom1": "",
          "custom2": "",
          "custom3": "",
          "custom4": "",
          "custom5": "",
          "custom6": "",
          "custom7": "",
          "custom8": "" 
      }
  } 
  </code></pre>
  
  <p>}</p>
  
  <h2>My Attempt</h2>
  
  <pre><code>        HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();
  
          if (request.HaveResponse == true)
          {
              Stream responseStream = webResponse.GetResponseStream();
              StreamReader responseReader = new System.IO.StreamReader(responseStream, Encoding.UTF8);
              string responseString = responseReader.ReadToEnd();
  
              JObject o = JObject.Parse(responseString);
  
              IList&lt;JToken&gt; results = o["partials"].Children().ToList();
  
              IList&lt;bbParial&gt; oResults = new List&lt;bbPartial&gt;();
  
              foreach (JToken t in results)
              {
                  if (t.ToString().Contains("partial"))
                  {
                      // Do nothing this is the header
                  }
                  else
                  {
                      bbPartial bbp = JsonConvert.DeserializeObject&lt;bbPartial&gt;(t.ToString());
                  }
              }
          }
  </code></pre>
  
  <h2>Sample Class</h2>
  
  <pre><code>public class bbpartial
  {
      public string _key;
      public string datetime;
      public string customer_id;
      public string domain;
      public string name;
      public string phone;
      public string email;
      public string offer;
      public string pub_id;
      public string sub_id;
      public string data1;
      public string data2;
      public string data3;
      public string custom1;
      public string custom2;
      public string custom3;
      public string custom4;
      public string custom5;
      public string custom6;
      public string custom7;
      public string custom8;
  }
  </code></pre>