Possible to create False Boolean when an object returns an error?


I’m not sure if this is possible… I’m hoping it is. I have a situation where I use an API call to get an object. I then retrieve an email address from this object.

This part is fine, this works.

My issue is that sometimes my API call will return a different object structure if a customer uses an online form to submit a ticket vs sending an email to us. This causes my API to return a different string.

Is there a way to return a boolean of FALSE when my string says “object reference not set to an instance of an object”? No matter what I try, I cannot continue. I want to be able to use an IF condition to get my string for either API instance.

Thank you.

Hi @Josh_James ,

Maybe a Check need to be performed using the Object Output using an If condition like below :

YourObjectOutputVar is Nothing                                     //Results FALSE if Empty

Thank you for the reply. I did try that, yes. It fails right away due to the object reference error.

These are the two different API results returned.



The string could be one or the other, but if one of these aren’t seen, it errors out.

Hm, I may not need to do this anymore. It looks like there might be a way in the API to tell which channel it came from, either API or Email. I could just create a new variable at the beginning for this, then make my decisions based on this result.


You could actually leverage .has method on the jobject that you get after deserializing

You can specify jobj.has(“keyname”) Which would give true or false

Also may be you can try IsNothing(job("Key1")("Key2")) without .ToString


1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.