cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dramus
Advocate I
Advocate I

Getting a list of the JSON Keys (Not the values) from a json object.

Trying to get a list out of planner of which labels have been applied to which tasks.

Planner returns the information as the following JSON object:

 

 
"appliedCategories": {
"category1": true,
"category3": true 
}
Labels that are not applied do not show up. Just the ones that are on the task.
 
I can't find a way to either:
  1. Get a list of the keys, or
  2. Find a way for the flow not to fail if a key doesn't exist.
5 REPLIES 5
v-yuazh-msft
Community Support
Community Support

Hi @Dramus,

 

I have made a test on my side and couldn't find a way to get a list of the JSON Keys from a json object.

I afraid that there is no any way to get a list of the JSON Keys from a json object in microsoft flow currently.

 

Best regards,

Alice

That was my conclusion too.

 

Maybe there is a way to use Filter Array and length() to see if the key exists.

 

 

Found a way to do it with contains().

Hi @Dramus,

 

If your problem has been solved, please go ahead to share your solutions and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!

 

Best regards,

Alice

 

Hi @Dramus,

 

I have similar requirement and contains did not work for me. Could you please share the solution that worked for you? 

 

I need 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": {}
}
],

Thanks,

SV

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (3,024)