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!
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.
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.
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.
To convert unknown objects to typed data we have the following functions available in Power Apps:
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.
Continue Reading Pieter Veenstra’s Article on their blog
Use ParseJSON in Power Apps to retrieve data from Power Automate
Recently a new ParseJSON feature was added to Power Apps. ParseJSON in Power Apps is possibly one of the most complex functions available.
Blog Syndicated with Pieter Veenstra’s Permission