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 Apps / Beautifying JSON strin...
Power Apps
Answered

Beautifying JSON string in powerapps

(0) ShareShare
ReportReport
Posted on by 15

Hi all,

 

Is there any way to beautify json string (it could be any json string) in powerapps

 

Example json string

 

[{"Cities":[{"City":"London","Population":8615000}],"Country":"United Kingdom"},{"Cities":[{"City":"Berlin","Population":3562000}],"Country":"Germany"}]

 

Expected Formatted string

 

[
{
"Cities":[
{
"City":"London",
"Population":8615000
}
],
"Country":"United Kingdom"
},
{
"Cities":[
{
"City":"Berlin",
"Population":3562000
}
],
"Country":"Germany"
}
]

Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Arthy_A26 :

    Please try this formula:

    Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     TheJSONString,
     "[",
     "[" & Char(13)
     ),
     "}",
     Char(13) & "}" & Char(13)
     ),
     "{",
     "{" & Char(13)
     ),
     ",",
     "," & Char(13)
     ),
     "}" & Char(13) & ",",
     "},"
    )

    I've made a test for your reference:

    1\Add a text input control(TextInput1) and input the string you provided.

    2\Add a label control and set it's Text property to:

    Substitute(
     Substitute(
     Substitute(
     Substitute(
     Substitute(
     TextInput1.Text,
     "[",
     "[" & Char(13)
     ),
     "}",
     Char(13) & "}" & Char(13)
     ),
     "{",
     "{" & Char(13)
     ),
     ",",
     "," & Char(13)
     ),
     "}" & Char(13) & ",",
     "},"
    )

     1.PNG

    Best Regards,

    Bof

  • PatilChetan Profile Picture
    on at

    @Arthy_A26 

     

    Refer the link: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-json#hierarchical-data 

     

    JSON function - Power Apps _ Microsoft Docs - Google Chrome 4_16_2021 3_05_49 PM.png

     

     

    Regards,

    Chetan

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard