cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mattw112IG
Impactful Individual
Impactful Individual

Anyone have an idea

Lets say I have a multiline text field in SharePoint with text like:

*Item 1 - First Item

*Item 2 - Second Item

 

In flow I would like to take the contents of that field and convert it to JSON like:

 

{
"element": "*Item 1 - First Item"
},
{
"element": "*Item 2 - Second Item"
}

 

Does anyone have some suggestions or code that would work similarly.

 

So my guess is I would need to split the multiline text field at carriage returns (or asterisk)

Then for each chunk, add in my text around it

Then if it is the last chunk no comma at the end of the line for }

 

Thanks,

Terry

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @Mattw112IG 

 

Yes you need to use Split expression using carriage return. Then check the length of the split result (array). Depending on the count you can construct the format in a variable type string. Append the string if array length is greater than one starting with comma and your variable.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

1 REPLY 1
abm
Super User
Super User

Hi @Mattw112IG 

 

Yes you need to use Split expression using carriage return. Then check the length of the split result (array). Depending on the count you can construct the format in a variable type string. Append the string if array length is greater than one starting with comma and your variable.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (1,916)