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 / How i can dynamically ...
Power Automate
Unanswered

How i can dynamically build part of a string array inside Compose

(0) ShareShare
ReportReport
Posted on by 3,506

I have this json array which i am passing as part of an http request boy:-

 

johnjohn123_0-1684002618325.png

 

here is the string:-

 

 

 

"peoplePickerInput":"[ { \"Key\":\"@{items('Apply_to_each_-_Certificates_2')?['EmailAddressNo1']}\"},{ \"Key\":\"@{items('Apply_to_each_-_Certificates_2')?['EmailAddressNo2']}\" } ]"

 

 

now i want to build a compose to check if the following is empty:-

 

 

 

@{items('Apply_to_each_-_Certificates_2')?['EmailAddressNo2']}

 

 

and if so to only have one item inside the array:-

 

 

"peoplePickerInput":"[ { \"Key\":\"@{items('Apply_to_each_-_Certificates_2')?['EmailAddressNo1']}\"}]"

 

 

so how i can do this inside compose and pass the output of the compose to the ""Send http request" action ?

Categories:
I have the same question (0)
  • lbendlin Profile Picture
    8,479 Super User 2025 Season 2 on at

    Use

     

    empty(items('Apply_to_each_-_Certificates_2')?['EmailAddressNo2'])

     

    to construct the string/enumeration either with two addresses or with one address.

  • johnjohn123 Profile Picture
    3,506 on at

    @lbendlin  Thanks for the reply,, i know about empty function, my concern is about building the array , as you can see it already contain " & \"  so not sure how i can construct the array string inside an expression? any advice?

  • lbendlin Profile Picture
    8,479 Super User 2025 Season 2 on at

    If you feel uncomfortable doing the string escaping in a Compose action you can use a Control decision action (aka if then else) to handle the two scenarios separately. Maybe you can show what you have tried so far.

  • johnjohn123 Profile Picture
    3,506 on at

    @lbendlin having 2 branches inside a condition will require me to duplicate many steps, as there are many subsequent actions which depend on the result.. so i would better do it inside a compose.. but not sure how i can construct the array string? any advice?

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard