'Azure Data Factory Expression to Check if Property is Defined

I am working with JSON structured data in ADF and trying to implement an IF condition where, if a property is defined in JSON, I will execute one path, another if not defined.

For example, consider the JSON data:

{
 "name" : "sh"
 "RareProperty" : "rarevalue"
}

RareProperty may or may not exist depending on scenario.

If I try to reference RareProperty in the If Condition block, I get an error saying property RareProperty not defined, which is understandable as the property isn't actually defined in the scenario.

I am looking for a way to check if a property is defined without getting any error.



Solution 1:[1]

I think you can use the ? something like

@{body('yourresponse')?['RareProperty']}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 HimanshuSinha-msft