title: Read JSON object properties that may not be defined
body: <p>Okay so I'm writing a windows form application that gathers data from a web sites html source code.</p>
  
  <p>It needs to grab the gender of the person, but some people do not have a gender set so the gender doesn't show in the source code so it's throwing me an error.</p>
  
  <p>What I'm wanting to do instead is if source code does not contain "gender" then <code>Console.Write = "N/A"</code>.</p>
  
  <p>Here is the code I currently have / am using to capture the data for gender.</p>
  
  <pre><code>JObject ob = JObject.Parse(html);
  ob = JObject.Parse(html);
  Console.WriteLine(html);
  gt.gender = (string)ob["data"]["user"]["gender"];
  Console.WriteLine(gt.gender);
  </code></pre>
  
  <p>I'm still kind of new to this so I'm wondering if there is some sort of if or else statement I could use there so it's not going to throw me an error in my application if the source code does not contain "gender".</p>
  
  <p>Much appreciated.</p>