title: Get values and keys in json object using Json.Net C#
body: <p>Hi there I have json that looks like this:</p>
  
  <pre><code>{
      "Id": " 357342524563456678",
      "title": "Person",
      "language": "eng",
      "questionAnswer": [
          {
              "4534538254745646.1": {
                  "firstName": "Janet",
                  "questionNumber": "1.1"
              }
          }
      ]
  }
  </code></pre>
  
  <p>Now I have written some code that loops over the objects in the <code>questionAnswer</code> array and then gets the name of the object which is <code>4534538254745646.1</code>. Now Im trying to save the key of each Item and the value aswell but I am only managing to get the value.</p>
  
  <p>How would I do this, here is my code:</p>
  
  <pre><code>JToken entireJson = JToken.Parse(json);
  JArray inner = entireJson["questionAnswer"].Value&lt;JArray&gt;();
  
  
  foreach(var item in inner)
  {
       JProperty questionAnswerDetails = item.First.Value&lt;JProperty&gt;();
       //This line gets the name, which is fine
       var questionAnswerSchemaReference = questionAnswerDetails.Name;
       var properties = questionAnswerDetails.Value.First;
  
       //This only gets Janet
       var key = properties.First;
       var value = properties.Last;                                      
  }
  </code></pre>
  
  <p>So at the moment Im only able to get Janet, But I also want the firstname field. I want to then take this and add to a dictionary i.e. </p>
  
  <pre><code>Dictionary&lt;string, string&gt; details = new Dictionary&lt;string, string&gt;();
  //suedo
  foreach(var item in questionAnswerObjects)
  details.Add(firstName, Janet);
  //And then any other things found below this
  </code></pre>