cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Abhilash
Helper III
Helper III

verifying json properties existing or not in json array

i have an requirement that i' am calling API through flow. That will return some set of json properties.

In that json array I need to check whether a property is present or not. 

 

For ex some array has vendor, PO number property.

some array has only a message.

it depends on API input. how can I check property message is exist in the array where it is not present.

 

Please suggest me this.

1 ACCEPTED SOLUTION

Accepted Solutions
ManishJain
Solution Sage
Solution Sage

HI @Abhilash ,

 

You can either use contains function to check if the output of your call has the property you are looking for. eg. 

 

contains(body('action Name'),'PO') --> will return true or false 

 

Also you can do is 

body('Action Name')?['PO'] is not equal to null 

 

Thanks

View solution in original post

2 REPLIES 2
ManishJain
Solution Sage
Solution Sage

HI @Abhilash ,

 

You can either use contains function to check if the output of your call has the property you are looking for. eg. 

 

contains(body('action Name'),'PO') --> will return true or false 

 

Also you can do is 

body('Action Name')?['PO'] is not equal to null 

 

Thanks

View solution in original post

abm
Super User
Super User

Hi @Abhilash 

 

Generate the full schema with all the possible properties. Here is an example.

 

{
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "Place": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    }

Above if you want to make Place property optional then change to

 

"type": ["string", "null"]

 This way you don't need to check whether it exists or not.

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blogPower Automate Video Tutorials

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,999)