title: Deserializing JSON Data with JSON.NET
body: <p>I am having trouble working with an API, first time I've worked with one. I've managed to use GET to read the data I need and that part is working perfectly, now I need to deserialize the JSON data I am getting back, and I am using Newtonsoft's JSON .NET library. The problem seems to come when I deserialize the data as its exploding and the debugger isn't being helpful. I tried a few suggestions online but no go, so if someone can enlighten me it'd be appreciated. This is the code:</p>
  
  <pre><code> string url = "";
   HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
   HttpWebResponse response = (HttpWebResponse)request.GetResponse();
   Stream receiveStream = response.GetResponseStream();
   StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
  
   string responseData = readStream.ReadToEnd();
  
   var results = JsonConvert.DeserializeObject&lt;dynamic&gt;(responseData);
   var id = results["id"].Value;
   // var name = results.Name;
  </code></pre>
  
  <p>When I run it the debugger throws the following exception at the last line of code:</p>
  
  <blockquote>
    <p>{"Accessed JArray values with invalid key value: \"id\". Array position index expected."}</p>
  </blockquote>
  
  <p>I am fairly sure that ID exists in the data I am getting back. </p>
  
  <p>Json data I am getting back from Smarty Streets:</p>
  
  <pre><code> [
  {
      "id": 0,
      "candidate_index": 0,
      "delivery_line_1": "1600 Amphitheatre Pkwy",
      "last_line": "Mountain View CA 94043-1351",
      "delivery_point_barcode": "940431351000",
      "components": {
          "primary_number": "1600",
          "street_name": "Amphitheatre",
          "street_suffix": "Pkwy",
          "city_name": "Mountain View",
          "state_abbreviation": "CA",
          "zipcode": "94043",
          "plus4_code": "1351",
          "delivery_point": "00",
          "delivery_point_check_digit": "0"
      },
     ]
  </code></pre>