I’m using UiPath HTTP API activities for scraping some data.
The API I’m currently working with will not always return the same structure. For example, in about 5% of the cases, a specific property (let’s say “date”) may not be available.
So sometimes the response may be results:
[{name: “xyz”, place: “abc”, date: “123”}]
but sometimes it may be:
[{name: “xyz”, place: “abc”}]
How do I handle this with IF (or anything else)?
I’m getting the “object reference not set to an instance of an object” error. I have tried using the deserialize portion inside an IF block which checks wherther isNothing(object), but same error.
Hi,
I think it’s the ToString method that is throwing the error. Since we are doing a ToString on an object that doesn’t exist
Can you try removing the ToString, and then try?
for a more defensive handling the existence of a JSON Property we can do:
we use this often for techniques when setting up generic extraction flows and and calculate existing properties against a list of interested properties