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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to check specific ...
Power Automate
Unanswered

How to check specific value is exist in JsonAsCustomObject PAD?

(1) ShareShare
ReportReport
Posted on by 357

Hi Team, 

I want to check specific value is exist in JsonAsCustomObject var.

Currently I am looping through this object and then use if condition. Json... has 100 files, 

and condition has been checking for 100 times within loop , 

In future there are more than 100 files

Now I wan to check just specific value is exist or not in json without using loop

Sanket1_0-1720080798576.png

 

  • CU16071609-1 Profile Picture
    6,255 Moderator on at

    @Sanket1 

     

    It will utilize a loop, but this will yield super faster results compared to PAD actions.

     

    You can substitute 'Jsonstring' with your JSON variable, and the 'search variable' can be replaced with your PAD variable.

     

    Deenuji_0-1720086098917.png

     

    Below is the full PAD code(Not powershell code):

    @@copilotGeneratedAction: 'False'
    Scripting.RunPowershellScript.RunPowershellScript Script: $'''function ValueExistsInJson {
     param (
     [string]$jsonString,
     [string]$valueToCheck
     )
    
     $jsonObject = $jsonString | ConvertFrom-Json
    
     # Flatten the JSON object into a list of values
     $allValues = $jsonObject | ForEach-Object -Process {
     $_.psobject.Properties.Value
     }
    
     # Check if the specific value exists in the list of values
     return $allValues -contains $valueToCheck
    }
    
    # Example usage
    $jsonString = \'[
     {\"id\": 1, \"name\": \"John\"},
     {\"id\": 2, \"name\": \"Doe\"},
     {\"id\": 3, \"name\": \"Jane\"}
    ]\'
    
    $valueToCheck = \"Deenu\"
    
    $result = ValueExistsInJson -jsonString $jsonString -valueToCheck $valueToCheck
    Write-Output $result # Output will be True or False
    ''' ScriptOutput=> PowershellOutput

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 132

Last 30 days Overall leaderboard