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 / Extracting a specific ...
Power Automate
Answered

Extracting a specific key value from $formdata array

(0) ShareShare
ReportReport
Posted on by 124

Hi all,

 

I'm having trouble extracting a specific key value from a $formdata array.

 

Below is a sample snippet of the data:

{
"$content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"$content": "Z25hbWU9YXNkJmJuYW1lPWFzZCZncGhvbmU9MjMmYnBob25lPTEyMyZlbWFpbGFkZHJlc3M9YXNkYXNkJTQwYWZzZGYuY29tJnRlbGVwaG9uZT0wNTUwNTAmYWRkPWFzZGFzZCZzdD1hc2Rhc2Qmdj1hc2Rhc2QmZGF0ZXBpY2tlcjE9MjYtMTItMjAxOCZkb25hdGlvbj0yNTAmdGV4dD1hc2Rhc2QmbWFrZXVwPWFzZCZoYWlyPWFzZGFzZCZkaj1hc2QmcmF2PWFzZCZkcmVzcz1hc2QmZD1hc2QmbW9yYW49YXNkJm1hZ25ldD0mbW9yZXRleHQ9",
"$formdata": [
{
"key": "gname",
"value": "asd"
},
{
"key": "bname",
"value": "asd"
},
{
"key": "gphone",
"value": "23"
},
{
"key": "bphone",
"value": "123"
},
{
"key": "emailaddress",
"value": "asdasd@afsdf.com"
},
{
"key": "telephone",
"value": "055050"
},
{
"key": "add",
"value": "asdasd"
},
{
"key": "st",
"value": "asdasd"
},
{
"key": "v",
"value": "asdasd"
},
{
"key": "datepicker1",
"value": "26-12-2018"
},
{
"key": "donation",
"value": "250"
},
{
"key": "text",
"value": "asdasd"
},
{
"key": "makeup",
"value": "asd"
},
{
"key": "hair",
"value": "asdasd"
},
{
"key": "dj",
"value": "asd"
},
{
"key": "rav",
"value": "asd"
},
{
"key": "dress",
"value": "asd"
},
{
"key": "d",
"value": "asd"
},
{
"key": "moran",
"value": "asd"
},
{
"key": "magnet",
"value": ""
},
{
"key": "moretext",
"value": ""
}
]
}

 

I know I can use the Parse JSON step to comvert this array into a key and value dynamic content which will apply to each for every one of the array items.

 

The problem is that for example I only want to select the value of say key "dress", without it looping through every single array object, of which there's over 200.

 

I've tried various expressions and not finding a method of doing this apart from specifying the position number of the value.

 

Is there another way around this?

Categories:
I have the same question (0)
  • Jcook Profile Picture
    7,781 Most Valuable Professional on at
    Hello @Mick282

    Why do you not want to iterate over the array?
    Are you doing this multiple times in the flow?

    —Josh
    If you like my post please hit the "Thumbs Up" -- If my post solved your issue please "Mark as a Solution" to help others
  • MikeC282 Profile Picture
    124 on at

    So the reason is that. The data comes from a webhook, which is fired when someone submits a form.

     

    The $formdata array is then divided into array objects with key value pairs for each field name (set as the key) and the value of the field. The problem is that the $formdata array object also contains key value pairs not relating to any of the form field data. Things like the width of the form etc.

     

    I only want to extract the key value pairs related to the the fields on the form and not anything else. If I loop through everything, there's 200 + key value objects and 99% of these key value objects aren't related to the fields. So looping through 200+ objects just to extract maybe 9 key value pairs that are related to the fields on the form seems a bit inefficient. If there's no other way then I'll have to but hoping there is a way.

     

    Kind regards

  • Verified answer
    efialttes Profile Picture
    14,756 on at
    Hi!
    Did you also consider (and discarded) 'Filter Array' action block? Probably not perfect, but much more efficient than Apply to Each

    Thanx!

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

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard