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 Automate
Answered

Parsing text to JSON

(0) ShareShare
ReportReport
Posted on by

I have the following text below

 

Old email: someone@microsoft.com

New email: someone1@microsoft.com

 

Now, I need to transpose this string to JSON using existing Power Automate functions, e.g.

{

   "old_email": "someone@microsoft.com",

   "new_email": "someone1@microsoft.com"

}

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @fallabe ,

     

    I've made a test for your reference:

    vbofengmsft_1-1666948757536.png

     

    Value:

    {
    "@{split(split(variables('Text'),decodeUriComponent('%0A'))[0],':')[0]}":"@{split(split(variables('Text'),decodeUriComponent('%0A'))[0],':')[1]}",
    "@{split(split(variables('Text'),decodeUriComponent('%0A'))[1],':')[0]}":"@{split(split(variables('Text'),decodeUriComponent('%0A'))[1],':')[1]}"
    }


    Result:

    vbofengmsft_2-1666948786055.png

     

    Best Regards,

    Bof

     

     

  • takolota1 Profile Picture
    4,980 Moderator on at

    @fallabe @v-bofeng-msft 

    Are the strings separated by a linebreak, or is there no separation?

    If there is a linebreak, then you could split on that & then use a couple replaces to do all this without manually typing everything out in a variable...

     

    json(
    concat(join(
    split(
    replace(
    replace(
    replace(InsertDataHere,
    decodeuricomponent('%0A'), concat('"', decodeuricomponent('%0A'))),
    'Old email:', '"old_email":"'),
    'new_email:', '"new_email":"'),
    decodeuricomponent('%0A')),
    ','), '"')
    )

     



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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 425

#2
11manish Profile Picture

11manish 323 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 274

Last 30 days Overall leaderboard