title: Unable to use JSON data with Newtonsoft.Json in WPF
body: <p>I am retrieving data from office365 api. The response is in JSON format. I want to get data like Id, DisplayName etc. into variables but not getting the right way to do it. Following <a href="http://www.newtonsoft.com/json/help/html/QueryingLINQtoJSON.htm" rel="nofollow noreferrer">this link</a>. I'm new to API and JSON. Will Appreciate pointers as well towards best learning links.Sample JSON below for listing sub folders of Inbox folder. </p>
  
  <p><strong>Response JSON data.</strong></p>
  
  <pre><code>{"@odata.context":"https://outlook.office365.com/api/v1.0/$metadata#Me/Folders('Inbox')/ChildFolders","value":
  [
  {"@odata.id":"https://outlook.office365.com/api/v1.0/Users('sample.user@demosite.com')/Folders('AAMkADBjMGZiZGFlLTE4ZmEtNGRlOS1iMjllLTJmsdfsdfdDSFSDFDFDF=')",
  "Id":"AAMkADBjMdfgdfgDFGDFGDFGdfGDFGDFGDFGGDzrACAAB4xqMmAAA=",
  "DisplayName":"SampleFolder","ParentFolderId":"AAMkADBjMGZiZGFlLTE4ZmEtNGRlOS1sdsDFSDFSDFSDFSDFSDFDFDFrACAAAAAAEMAAA=","ChildFolderCount":0,"UnreadItemCount":8,"TotalItemCount":94},
  {"@odata.id":"https://outlook.office365.com/api/v1.0/Users('sample.user@demosite.com')/Folders('AAMkADBjMGZiZGFlLTE4ZmEasdasdasdASDASDASDASDSADDASDASDAB4xqMnAAA=')",
  "Id":"AAMkADBjMGZiZGFlLTE4ZmEtNGRlOS1iMjllLTJmOGZkNGRhZmIzNQAuAasdASDASDASDASEDASDASDxSEHjzrACAAB4xqMnAAA=",
  "DisplayName":"AnotherSampleFolder","ParentFolderId":"AAMkADBjMGZiZGFlLTE4ZmEtNGRlOS1sdsDFSDFSDFSDFSDFSDFDFDFrACAAAAAAEMAAA=","ChildFolderCount":0,"UnreadItemCount":21,"TotalItemCount":75}
  ]
  }
  </code></pre>
  
  <p>The <strong>C# code</strong> using to parse JSON and find the required data.</p>
  
  <pre><code>HttpResponseMessage response = httpClient.SendAsync(request).Result;
  
  if (!response.IsSuccessStatusCode)
    throw new WebException(response.StatusCode.ToString() + ": " + response.ReasonPhrase);
  
   string content = response.Content.ReadAsStringAsync().Result;
   JObject jResult = JObject.Parse(content);
  
  
  if (jResult["odata.error"] != null)
                  throw new Exception((string)jResult["odata.error"]["message"]["value"]);
  //Attempt one - using dynamic  [NOT WORKING - getting NULL values in the variables]         
  dynamic results = JsonConvert.DeserializeObject&lt;dynamic&gt;(content);
  var folderName = results.Id;
  var folderId = results.Name;
  //Attempt two - [Not working - Throwing exception - 
  //Object reference not set to an instance of an object.]
  var folderID = (string)jResult["odata.context"]["odata.id"][0]["Id"];
  </code></pre>