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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

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

Users online (3,389)