Try catch inside assign activity

Hey all

I am doing an API call to retrieve details. Its a JSON structure. Once I have Deserialized the JSON I have a multiple assign. Each variable I reference a certain location in the JSON. Sometimes all the details I am looking for is in the response but now and there there can be one or 2 that is missing. I don’t want to wrap over 15 variables with a try catch for each one. So I was wondering if someone knows if you can do a try catch inside of an assign?

Thanks

You should just For Each through the properties of the JSON object, doing the Assign inside the For Each. Then you’re guaranteed only to get the ones that exist.

@Etienne8125

You can also use jsn.ContainsKey("KeytoSearch") which returns true if present else false

so inassignc an sue like this If(jsn.ContainsKey("KeytoSearch"),jsn("KeyToSearch").ToString,"")

cheers

2 Likes

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