Use ParseJSON in PowerApps to retrieve data from Power Automate Microsoft Power Apps, Microsoft Power Automate image 46

Recently a new ParseJSON feature was added to Power Apps. ParseJSON is possibly one of the most complex functions available in Power Apps. in this post some help!

ParseJSON Introduction

Imagine that we have a flow that sends data back to a Power App using a text property in the Respond to a PowerApp or flow action.

Use ParseJSON in PowerApps to retrieve data from Power Automate Microsoft Power Apps, Microsoft Power Automate image 45

But rather than creating multiple fields we return everything as a single text property. Now the app will receive a text that contains the above json.

But it will retrieve it as a text rather than a json object. We can now use the ParseJSON Function to get the details.

So how does ParseJSON work?

In the below example you can see the ParseJSON action is use. My Get Record button, runs my flow and retrieves a text containing my json object.

ParseJSON function in Power Apps

The MyRecord result is a text variable, but the ParseJSON turns this into an untypedObject. What is an Untyped Object I hear you ask. An Untyped Object is the big unknown here. We don’t know what it looks like. however there are properties within the untyped object. In the above example I can get to the Code property, but I can’t use it until it is converted to a number using the Value function.

Conversion functions

To convert unknown objects to typed data we have the following functions available in Power Apps:

  • Boolean
  • ColorValue
  • Value
  • DateValue
  • GUID
  • Text
  • Table

So far we have seen the simple conversion of simple types, like text and numbers and dates. But what is there is a further data structure that we want to get to?

In the above example we saw the Details property actually giving us a full object. But how do we get to for example the Title property?

We can only use each of the properties that exist in the data. Therefore something like this will work. Once we have included the Text function we can now use the Title in for example a label or an input box.

Text(ParseJSON(myRecord.result).Details.Title)

Notice that it isn’t possible to get full Objects. It would be nice if there was a conversion action that did similar things to the Parse JSON action in Power Automate. This Object would need to have the schema for the data supplied but Object Conversion would make things a lot easier. Maybe something for the future. I created an Idea for this on the Power Users Forms, please upvote this.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

8 thoughts on “Use ParseJSON in PowerApps to retrieve data from Power Automate”
  1. Hi there,

    I just wanted to give you the heads up that I have managed to use this feature to remove the need for 3 power automate flows and some rather long code for each of the 3 JSON strings. Since my data is actually stored in a sharepoint column, it was pointless going to PA and not to say that it much faster for my use case.

    Also I have managed to build a this into a collection as well – something that I thought that would be covered here.

    Cheers

  2. Pieter, do you know if it’s also possible to return values from Power Automate to Powerapps from flows that aren’t started from Powerapps?

    I have a function that writes a record to SQL and a flow that is triggered ‘on new record creation in SQL’ but I would like the outcome of that flow to be returned back to Powerapps.

    1. Hi Koen,

      There isn’t a direct options to send an alert to the app, but …

      You could potentially get the flows to update a data source. Then within your app read (and refresh) that data source regularly using a timer so that your app can then be ‘triggered’ on this update.

      1. Thanks for the suggestion! I was rather thinking of rewriting the function that saves the record in SQL and start a flow from there to do all other stuff in the background (creating an ms project file on the project server with info from SQL). I could then make the powerapp wait for the result from that flow.

  3. That’s actually what I meant… the flow will stay the same but instead of being it triggered from ‘creating a new record in sql’ it will be triggered from my powerapp. The heavy duty remains in the flow but I will be able to send the result back to the app. Or am I wrong?

    1. Unless you make the app wait (or run the flow from a timer, but that opens a whole other can of worms) that will not be possible. If you make the app wait and use the Set command around the flow run function to collect the result back then it is possible. But if your flow takes a while you might find that you get a poor UX. You could of course get a timer to control a progress bar within the app.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.