cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
stgiesbrecht
Kudo Commander
Kudo Commander

Creating and working with arrays

I am trying to take the output from a Form response and create an array or object that I can then loop through and do a find and replace so that I can update an HTML template file with the answers that someone submitted.

If I view the output from a compose on the form get response details I see

{
  "responder": "joe@abc.com",
  "submitDate": "10/15/2019 3:25:48 PM",
  "rd150a2c9a12f42c683dcfabec7f32a52": "Jim",
  "r6d253b9398c14d4f853d8c0df68d0857": "Bob",
  "r9c2da6f89bf74338b7395d49a99fe5ac": "jbob@gmail.com",
  "r99e5c06a5a1e4d179907101b6aaf53cd": "Calgary",
  "r717f9de19e0f44ab8a3fe7a3bb6b8e20": "",
  "rd8629ebb96a0487cb1e703adc805f048": "ABC Corp"
}
 
I can then do a Select to map the fields that I want to the find text like this
[
  {
    "{FirstName}": "Jim",
    "{LastName}": "Bob",
    "{Email}": "jbob@gmail.com",
  }
]
 
I would like to convert this to something that I can then use an "Apply to each" and take and loop through
each element and replace the string in the "{}" with the second string after the ":" in my HTML string
 
If I take an initialized hardcoded object variable of this and pass it to the "Apply to each" I can get
it to work. Is there a way to convert my Select above to get something similar to below
{
  "fields": [
    {"Name": "{FirstName}",
      "Value": "Jim"},
    {"Name": "{LastName}",
      "Value": "Bob"},
    {"Name": "{Email}",
      "Value": "jbob@gmailcom"}
  ]
}
 
Any suggestions would be greatly appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
v-alzhan-msft
Community Support
Community Support

Hi @stgiesbrecht ,

 

I have made a test and couldn't find any way to achieve the requirement, I'm afraid that there is no any way to achieve it in microsoft flow currentl.

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-alzhan-msft
Community Support
Community Support

Hi @stgiesbrecht ,

 

I have made a test and couldn't find any way to achieve the requirement, I'm afraid that there is no any way to achieve it in microsoft flow currentl.

 

Best regards,

Alice       

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

 

Hey, depends on how good is your XPath 🙂

http://johnliu.net/blog/2017/11/foreach-property-in-microsoftflow-json-with-xpath-microblog

 

Bonus tip 1.  XML really doesn't like funny preceeding characters, so if you can control your initial mapping to avoid starting a property with numbers, you'll have a much better time.

 

Bonus tip 2.  If you want to dynamically read the Forms questions, you will need Flow dark arts.
https://www.youtube.com/watch?v=XwJto7zvfyk&feature=youtu.be

Good luck!

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,003)