We need to check to see if a JSON value is null or not. Here is the JSON:
"customfield_25300": null,
When using the "If" statement, with "Isn't empty", a "variable doesn't have a property" error message is presented (screenshots below). This error message doesn't appear, however, if customfield_25300 contains a value (e.g. "John") instead of null. This makes us think that our value in "First operand" is correct, but that the null in the JSON is in some way confusing the "If" statement.
How do you check for null in Power Automate Desktop?
Solved! Go to Solution.
There is already solution here
More Samples
Copy and paste to your PAD designer.
SET NewVar TO $'''{\"name\":\"John\", \"age\":30, \"car\":null}'''
Text.Replace Text: NewVar TextToFind: $'''%'null'%''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%'\"\"'%''' ActivateEscapeSequences: False Result=> NewVar
Variables.ConvertJsonToCustomObject Json: NewVar CustomObject=> JsonAsCustomObject
IF IsEmpty(JsonAsCustomObject['car']) THEN
Display.ShowMessage Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed3
END
There is already solution here
More Samples
Copy and paste to your PAD designer.
SET NewVar TO $'''{\"name\":\"John\", \"age\":30, \"car\":null}'''
Text.Replace Text: NewVar TextToFind: $'''%'null'%''' IsRegEx: False IgnoreCase: False ReplaceWith: $'''%'\"\"'%''' ActivateEscapeSequences: False Result=> NewVar
Variables.ConvertJsonToCustomObject Json: NewVar CustomObject=> JsonAsCustomObject
IF IsEmpty(JsonAsCustomObject['car']) THEN
Display.ShowMessage Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed3
END