title: Connectwise API missing property value gives no response
body: <p>This question may very well be a general API question, but the API I am using is the Connectwise Tickets API.</p>
  
  <p>I'm writing in VB and I'm getting my list of tickets(i) then I'm setting the following variable:</p>
  
  <p>currentTicket = tickets(i) </p>
  
  <p>So that I can reference value like currentTicket.Source.Name and save the info to a DB.</p>
  
  <p>As long as the Connectwise user put something into the "Source" field, everything works fine. I can reference that property and log it to the database or whatever else I want to do. If they left it blank though, even trying to look at currentTicket.Source.Name stops my program in it's tracks. It doesn't crash or error out, it just doesn't go past the line of code referencing the empty field.</p>
  
  <p>Since it won't even let me reference currentTicket.Source.Name for example, I am unable to check to see if currentTicket.Source.Name = "" or Is Nothing.</p>
  
  <p>What am I missing? Is there a way to check and see if the property even exists for a given API response?</p>
  
  <p>Any help would be appreciated.</p>
  
  <p>EDIT:</p>
  
  <p>OK so I decided to take the Ticket object and grab the raw json and send it to the command line output.</p>
  
  <p>When a ticket has the source field filled in, this is what that section of the JSON looks like:</p>
  
  <pre><code>...
  },
    "servicelocation": {
    "id":4,
    "name":"remote",
    "_info":{
      "location_href":"https://API_url"
    }
  },
  "source":{
    "id":4,
    "name":"Email Connector",
    "_info": {
      "source_href":"https://API_url"
    }
  },
  "severity": "Medium",
  "impact":"Medium",
  ...
  </code></pre>
  
  <p>When the source field in the application has been left blank, the JSON looks like this instead:</p>
  
  <pre><code>...
  },
    "servicelocation": {
    "id":4,
    "name":"remote",
    "_info":{
      "location_href":"https://API_url"
    }
  },
  "severity": "Medium",
  "impact":"Medium",
  ...
  </code></pre>
  
  <p>That behavior is probably normal, I'm obviously just missing the knowledge of how to deal with it. I feel like I should be able to test if the property of the object is non-existent the same way I test if it's null or "", using Tickets(i).Source.Name, but I get no exceptions, no errors, no crashes, the program just sits their waiting for a response to "What's Source Name's value?"</p>
  
  <p>I mean I suppose I could parse out the entire JSON response, create my own private object, assign values as they exist and then set my own property values so I could then set mySourceName = "" When it doesn't exist in the JSON response, but that seems like a lot of work when I only care about like 10 fields and it's a pretty large json response.</p>
  
  <p>Is that the normal way of doing things with APIs? </p>