title: Get value from JSON object in c#
body: <p>I am getting JSON response from a url and I am capturing it with following code in <code>jObj2</code></p>
  <pre><code>dynamic jObj2 = JsonConvert.DeserializeObject(resultCheck.Content.ReadAsStringAsync().Result);
  Response.Write(&quot;&lt;p&gt;&quot;+jObj2+&quot;&lt;p&gt;&quot;);
  </code></pre>
  <p><strong>Output</strong> is:</p>
  <pre><code>{
      &quot;method&quot;:&quot;check&quot;,
      &quot;trace&quot;:&quot;1234/12345/123456f5&quot;,
      &quot;order&quot;:{
          &quot;ref&quot;:&quot;2910730E3E90D40F59BC9B738E71EF7AD9DF679C93D34EAEADA6775216F12C13&quot;,
          &quot;cartid&quot;:&quot;1723873570174343&quot;,
          &quot;test&quot;:1,
          &quot;amount&quot;:&quot;30.00&quot;,
          &quot;currency&quot;:&quot;USD&quot;,
          &quot;description&quot;:&quot;Descsdaff&quot;,
          &quot;status&quot;:{
              &quot;code&quot;:3,
              &quot;text&quot;:&quot;Paid&quot;
          },
          &quot;transaction&quot;:{
              &quot;ref&quot;:&quot;019463997038&quot;,
              &quot;type&quot;:&quot;sale&quot;,
              &quot;class&quot;:&quot;ECom&quot;,
              &quot;status&quot;:&quot;A&quot;,
              &quot;code&quot;:&quot;919514&quot;,
              &quot;message&quot;:&quot;Authorised&quot;
          },
          &quot;card&quot;:{
              &quot;type&quot;:&quot;Visa Credit&quot;,
              &quot;last4&quot;:&quot;0002&quot;,
              &quot;expiry&quot;:{
                  &quot;month&quot;:3,
                  &quot;year&quot;:2017
              }
          },
          &quot;customer&quot;:{
              &quot;email&quot;:&quot;email@email.com&quot;,
              &quot;name&quot;:{
                  &quot;forenames&quot;:&quot;James&quot;,
                  &quot;surname&quot;:&quot;Senior&quot;
              },
              &quot;address&quot;:{
                  &quot;line1&quot;:&quot;Denvour&quot;,
                  &quot;city&quot;:&quot;Denvour&quot;,
                  &quot;country&quot;:&quot;US&quot;
              }
          }
      } }
  </code></pre>
  <p>How can i access individual values for</p>
  <p><code>carid</code>  <code>code</code>  <code>ref</code>  ...</p>
  <p>I tried below code but it is give me error</p>
  <pre><code>var jsonData2 = (JObject)JsonConvert.DeserializeObject(resultCheck.Content.ReadAsStringAsync().Result);
      
  Response.Write(&quot;&lt;br&gt; jsonData2['order']['description'].ToString() &quot; + jsonData2[&quot;order&quot;][&quot;url&quot;].ToString())
  </code></pre>
  <p><strong>Error Message</strong></p>
  <pre><code>  Object reference not set to an instance of an object. Description: An
   unhandled exception occurred during the execution of the current web
   request. Please review the stack trace for more information about the
   error and where it originated in the code.
   
   Exception Details: System.NullReferenceException: Object reference not
   set to an instance of an object.
   
   Source Error:
   
   
   Line 65:                 Response.Write(&quot;&lt;br&gt;&quot;); Line 66:             
   Response.Write(&quot;&lt;br&gt;&quot;); Line 67:                 Response.Write(&quot;&lt;br&gt;
   jsonData2['order']['description'].ToString() &quot; +
   jsonData2[&quot;order&quot;][&quot;description&quot;].ToString()); Line 68:  Line 69:            
   }
  </code></pre>
  <p>How can i access individual values from json object</p>