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 / Formatting a JSON resp...
Power Apps
Unanswered

Formatting a JSON response from Power Automate flow on PowerApps

(0) ShareShare
ReportReport
Posted on by 139

We have a requirement to return a JSON output from flow triggered through PowerApps (Typical REST API call through flow). JSON response need to be beautified and show it on PowerApps.

However, the output step in the Power Automate doesn't support returning an object to the PowerApps. If we return the JSON response as text from the flow, then is there a way that we can parse it on PowerApps and show it to the end user.


Regards,
Srinivas

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    69,417 Most Valuable Professional on at

    Is the JSON you want to return an Array or just a simple object?  If its an array you'll need to use the HTTP response action to return the JSON array.  It can then be stored in a collection in Power Apps.  If its a simple object then use the Respond to Power Apps action and add the individual properties to the response.  You can then store the result as a variable.  Unfortunately, Power Apps does not have a function that can convert a string to an actual JSON object.

  • finseths Profile Picture
    4 on at

    @Pstork1 - Thank you for your reply.   I think the main question being asked is how to format the JSON string in Powerapps in a way that it keeps the JSON styling so the end user can amend the string.

     

    The scenario

    1. Use power apps as a front end to accept a variable ID

    2. Send to power automate and run HTTP Get request

    3. Send step 2 data back to Power apps for user to view/amend the value 

    4. Pass the amended string back into power automate to send as the body of a HTTP POST request

     

    Here is what I did, it is not pretty - nor efficient, but technically works to solve this scenario.

    Steps

    1. Collect the variable ID from power apps

    finseths_2-1619787406242.png

    2. Call Power automate flow on Get button to send an HTTP get call and pass the Reference ID

    3. Send back to Powerapp a string with the JSON text

    finseths_6-1619788377275.png

     

    4. Show the string to the user on Powerapps for them to amend. 

    When it comes back as a string, it is very difficult to read.  So i used substitute function to try to make it a little easier to distinguish fields
    Substitute(Substitute(Substitute(JSONText, ":{",":{" & "<br/>"),":[",":[" & "<br/>"),",\","," & "<br/>"& "\")

    finseths_4-1619787846402.png

    5. User then needs to amend the string and submit.   Upon Submit - another power automate flow is run and the string is reformatted to remove line breaks > sent back to power automate > converted back to JSON > used as body of a POST HTTP call

    finseths_5-1619788074640.png

     

    Question:

    Is there an easier way to achieve this?  Or - a way to make the JSON text in Powerapps look a bit more like JSON?

  • Pstork1 Profile Picture
    69,417 Most Valuable Professional on at

    What does the user need to amend in the JSON before sending it back?  Is it just values or are they actually changing property names etc?  If its just values then I would suggest saving the JSON as an object or collection and having the user edit the values.  Then use JSON() in Power Apps to resubmit it to the Flow.  If they are changing things that can change the underlying schema then I don't see a substantially better way to do it.  Letting users directly modify JSON for submission isn't a good approach in my opinion.  There are two many ways the whole string could become invalid.

  • finseths Profile Picture
    4 on at

    @Pstork1 Thanks so much for your quick reply.  I understand your concern with users amending the field names.  So, if i saved the JSON string as a collection in Powerapps, would i have to Loop through the string and break apart key/value pairs and show the field name as a label and value as editable text?  Im not quite sure on how to implement getting the JSON String into a collection.

     

    Thanks so much!

  • Pstork1 Profile Picture
    69,417 Most Valuable Professional on at

    If you return the values as a JSON array using the HTTP response action you can save the result directly into a collection.  Each key will then become a field in the collection.  You can then edit the values in the collection the same way you would edit any collection.  Or if its one record you can save it as a variable with properties.  The variable properties will also be editable.  For example, here is a flow that retrieves SharePoint list data and returns it to Power Apps for display.

    image.png

    The response object returns the JSON array that contains the data.

    image.png

    Here's the command that invokes the flow.  I pass in a filter variable which the flow uses to filter the results I want.  The JSON that is returned is stored as a collection.  The collection is then bound to a gallery where records can be selected for editing.  The collection can then be submitted using the JSON() function to another flow to be used for updating.  Here's what the collection looks like.

    image.png

     

     

  • yoyojojo48 Profile Picture
    4 on at

    Hi @pstork1,
    I just came around this post and I read your answer. First thank you for this because I am in the same situation. Unfortunately, when I run my flow in PowerApps, the created collection is empty.

    Capture.PNG

     

    I checked the schema of my flow, but I can't see any issue with that. Can someone please assist?  

    22.PNG

     

    Thank you and kind regards,

  • asha1 Profile Picture
    2 on at

    @yoyojojo48 

    Once you get your Flow working successfully & are passing off a variable back to PowerApps..

    Eg: 

    asha1_2-1667542486349.png

     

    You need to enable Experimentation Features in the options settings of the file first.

    This will enable the use of ParseJSON below.


    Then in PowerApps, click the App selection in Tree View

    asha1_0-1667542210270.png

    Then select OnStart from the drop-down

    asha1_1-1667542247733.png

    Then in the function path:

    ClearCollect(COLLECTIONNAME,ForAll( Table( ParseJSON( FLOWNAME.Run().vargroups)), { description: Text( Value.profile.description), id: Text( Value.id), type: Text( Value.type), name: Text( Value.profile.name), membership_updated: Text( Value.lastMembershipUpdated)}));

     

    ^^ The varusers variable is defined in the last step of the flow, as outlined above & also all the fields from your ParseJSON/Response output in the ClearCollect call.

  • yoyojojo48 Profile Picture
    4 on at

    hi @asha1, thank you for your reply! But you have a different flow than mine and I am not sure why I need to use the function parse Json in my canvas app when I already parse the body of the http in my flow.

    This is an overview of my flow
    Flow overviewFlow overview

    As you can see, I only selected the displayName and i get them both but in PowerApps the collection is empty:

    7.PNG  OnSelect function of my buttonOnSelect function of my button

     

  • Pstork1 Profile Picture
    69,417 Most Valuable Professional on at

    In your Parse JSON the top level that you are parsing is an object.  But then in the response your schema top level is an array.  Since you are using the same data in each place one of them is wrong.  I suspect the schema is right in the response, but the Content should be the Value array, not the Body coming out of the Parse JSON

  • Pstork1 Profile Picture
    69,417 Most Valuable Professional on at

    He's using that function so he can avoid using the HTTP Response action which is Premium.  The Respond to Power Apps can send a JSON string back to the Power App and then use the ParseJSON() function in Power Apps to Parse the result.  But as you can see from his post it takes some extra processing to do it that way.  If you have Premium licensing the HTTP response action is more straight forward.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 936

#2
Valantis Profile Picture

Valantis 604

#3
11manish Profile Picture

11manish 518

Last 30 days Overall leaderboard