web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Check if a property/ke...
Power Automate
Answered

Check if a property/key exists in JSON output

(0) ShareShare
ReportReport
Posted on by 181

I'm using "Invoke HTTP Trigger" action in my flow. Sometimes, this action returns JSON response without some keys.

Could someone help on how to check if keys like  locationUri, locationType exist in the JSON response. 

 

Condition contains(outputs('Invoke_an_HTTP_request'),'locationUri'did not help.

 

JSON Response

"location": {
"displayName": "",
"locationUri": "",
"locationType": "conferenceRoom",
"uniqueId": "",
"uniqueIdType": "directory",
"address": {
"street": "",
"city": "",
"state": "",
"countryOrRegion": "",
"postalCode": ""
},
"coordinates": {}
},
"locations": [
{
"displayName": "",
"locationUri": "",
"locationType": "conferenceRoom",
"uniqueId": "",
"uniqueIdType": "directory",
"address": {
"street": "",
"city": "",
"state": "",
"countryOrRegion": "",
"postalCode": ""
},
"coordinates": {}
}
],

Categories:
I have the same question (0)
  • djc998 Profile Picture
    16 on at

    I have this same problem. How do we handle if a property does not exist? In my example, I always get this error.

     

    InvalidTemplate. Unable to process template language expressions in action 'CurrentHealth' inputs at line '1' and column '2931': 'The template language expression 'if(empty(variables('trackerRows').cells[9].value),variables('trackerRows').cells[9].value,'null')' cannot be evaluated because property 'value' doesn't exist, available properties are 'columnId'. Please see https://aka.ms/logicexpressions for usage details.'.
  • djc998 Profile Picture
    16 on at

    I was able to solve the problem by using an if and then contains. This should solve your issue.

     

    if(contains(variables('trackerRows').cells[9], 'value'), variables('trackerRows').cells[9].value, 'null')
  • Verified answer
    v-bacao-msft Profile Picture
    on at

     

    Hi @sunithav ,

     

    You can try to use the property name in Compose to get the property value. If Compose fails, it means that the property does not exist.

    https://flow.microsoft.com/en-us/blog/error-handling/

     

    80.PNG

    Hope this helps.

     

    Best Regards,

  • CU20081036-0 Profile Picture
    181 on at

    Hi @v-bacao-msft ,

     

    Thanks for your response.

     

    I converted JSON response to string and used condition to check if string contains the required keyword.

     

    Thanks,

    SV

  • MartinPyman Profile Picture
    29 on at

    A slightly more elegant solution:

    Use the equals function in a condition step equal to false

     

    Example:

    equals( variables('JSON')?['<Property to Find>'] , null)
     
    MartinPyman_0-1659080609094.png

     

  • PabloD Profile Picture
    62 on at

    Very nice! Thank you.

  • jensweiltoyota Profile Picture
    4 on at

    Good try but it does not work. You can't access a property that does not exist. 

  • MartinPyman Profile Picture
    29 on at

    Flow running successfully and property marked as not existing:

     

    MartinPyman_0-1671551613780.png

     

    Here is the formula, I'm looking for "bob" which definitely is not in my json object:

     

    MartinPyman_61-1671551696144.png

     

    Did you give it a try? It'd be great to see why yours might be failing

     

  • 3tsolutions Profile Picture
    94 on at

    I wrote a solution to handle missing properties of an object, if it helps

    LINK

  • bookworm2death Profile Picture
    3 on at

    Make sure you have that ? between the variable and the property, mine didn't work until I noticed I missed that.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard