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 / Map object with a dyna...
Power Automate
Unanswered

Map object with a dynamic amount of values?

(0) ShareShare
ReportReport
Posted on by 1

(First off, I'm a beginner - so please excuse me if any of my language is incorrect)

 

I'm working on a flow where I'm trying to essentially scrape an email to create named values that can then be pulled into other aspects. I have a form that sends an email with the form content to an account, and I'm not able to modify the format of that email.

 

I've gotten far enough along that I get the field names and their values into an object:

jburnsrmhc_1-1688525447742.png

 

Which looks like this:

jburnsrmhc_2-1688525768769.png

 

{
 "@{trim(body('Filter_array')[0])}": @{trim(body('Filter_array')[1])},
 "@{trim(body('Filter_array')[2])}": @{trim(body('Filter_array')[3])},
 "@{trim(body('Filter_array')[4])}": @{trim(body('Filter_array')[5])},
 "@{trim(body('Filter_array')[6])}": @{trim(body('Filter_array')[7])},
 "@{trim(body('Filter_array')[8])}": @{trim(body('Filter_array')[9])},
 "@{trim(body('Filter_array')[10])}": @{trim(body('Filter_array')[11])},
 "@{trim(body('Filter_array')[12])}": @{trim(body('Filter_array')[13])},
}

 

 

Then I can do Parse JSON from there which is fantastic - but my issue is that if someone leaves a field blank when filling in the form, that is completely left out of the email, so the "Filter_array" array would now only go up to 11, and "body('Filter_array')[12])" and "body('Filter_array')[13])" would no longer exist. Is there a way to have the mapping only go through as many array values as actually exist?

Categories:
I have the same question (0)
  • S-Venkadesh Profile Picture
    1,214 Super User 2026 Season 1 on at

    Hi @jburnsrmhc ,

    There is a way to dynamically build a JSON object using Power Automate.

    1. Split the string by commas, which will give you an array of strings.
    2. you can loop through the array and fetch the first 2 strings (you can use an index variable to increment).
    3. Add property to dynamic object after required null check

    This article gives basic idea of how to build JSON object using addProperty function

    https://debajmecrm.com/how-to-add-remove-property-from-a-json-object-dynamically-using-power-automate/

     

    I hope this information is helpful. If it is, please consider giving a thumbs up.

     

    Best regards,

    Venkadesh Sundaramurthy

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 251 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 239

#3
Expiscornovus Profile Picture

Expiscornovus 220 Most Valuable Professional

Last 30 days Overall leaderboard