cancel
Showing results for 
Search instead for 
Did you mean: 

Parse JSON in PowerApps

Hi everyone,

 

The new JSON function in PowerApps is great and we have been using it extensively. Another great addition would be to parse JSON directly in PowerApps. If PowerApps receives a stringified JSON string, it should be able to easily Parse this and use this data in the app, to write it into a collection, variable or whatever.

 

We have been using the HTTP response in flow to return dynamic data to PowerApps, but seeing that this is now longer included in the Office 365 entitlement and that normal Respond To PowerApps Flow action not supporting Arrays or JSON, this request is quite urgent.

 

Please let us know if you have any questions or suggestions.

 

Kind regards

 

Dawid van Heerden
Follow on Twitter: @davestechtips
Subscribe to YouTube: https://www.youtube.com/davestechtips?sub_confirmation=1

Status: Under Review
Comments
MBDA
Advocate I

It is a must-have, Almost every app that I have worked on required this feature. 

TedBabcock
Helper II

I do have a premium license at my workplace (a large public university), but many users elsewhere don't have that luxury, so it would be great to put Response at the basic level.

 

But the ability to parse JSON directly in Power Apps is still needed. The flow Response action can have only one schema in any given flow. If I could parse within Power Apps as needed, then I could use the same flow to perform CRUD actions on any table in my data source (SQL Server). The flow would return updated data in one format for all needs (stringified JSON), which would then be pulled apart in the app. Flow can parse JSON, so why can't Power Apps?

HS91
Advocate I

100% this would be really useful

TedBabcock
Helper II

I have been working on this for a while, inspired by April Dunnam's video, "Power Apps Validation and JSON Parsing with Regex":

 

https://www.youtube.com/watch?v=2xWiFkBf294

 

I have a view from SQL Server that returns stringified JSON via a flow. I have gotten a simple example with just two Key:Value pairs to work. But now I've run into another problem. I'd like to pull just a few fields that I need out of a string that has many Key:Value pairs in it. Kind of a regex version of Power Apps' ShowColumns() function. But I can't seem to get it to work.

 

I have a string something like this:

 

{"Key1": Value1, "Key2":"Value2", "Key3":Value3, "Key4":"Value4"}

 

Plus many, many more columns. Now, I could alter the underlying SQL Server views being returned so that it only sends back the columns I want. But I'd like to do this in Power Apps so that the flow and the SQL Server can return the same basic data, and then I would select only the columns I want in any particular place in an app. That is, in the example above, I'd like to pull just (say) Key3:Value3 and Key14:Value14. But I don't know how to skip over the ones I don't want.

 

Here's the regex string that pulls all the fields of a sample string with just two key:value pairs:

 

"\{""Key1"":""(?<Key1>[^""]*)"",""Key2"":""(?<Key2>[^""]*)"

 

How do I write the regex that would skip over Key:Value pairs 1-2 and pull 3, then skip over Key:Value pairs 4-13 and pull 14?

 

As complicated as regex is, this solution would be much simpler than other suggestions using the Split() function.

 

Thank you!

MikeyMole
Advocate I

yes a reverse of the JSON function that just creates a datatable collection directly from JSON would be amazing!

MarshallB
New Member

Please, for the love of god, let us deserialize JSON. 

slalithprasad
Helper I

I badly need this. 

biterbit
Advocate V

Without this the Power Platform is a incomplete solution with structured data moving easily from Power Apps to Power Automate but not in the opposite direction. The licensing model makes using a premium feature like HTTP calls impossible for many organisations.