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 / Creating Power App^2 D...
Power Apps
Unanswered

Creating Power App^2 Developer Tools and generating PowerFX from JSON

(0) ShareShare
ReportReport
Posted on by 487

I'm trying to facilitate power apps development in the grey area between professional and non-professional (aka citizen) software developers. I want to create tools that may help both types of developers creating and using PCF components or more complex traditional components, and I believe it is important that I actually use Power Platform to achieve it.

I've often encountered a need to generate Power FX code, E.g. for static menu galleries or settings for various components etc. Even though ParseJSON() and JSON() are useful in many ways, there seems to be a barrier for exporting PowerFX object notation such as the code for a table or object in an app to the user. (Essentially just removing the double quotes from field names) 

I have arrived at a hack and I'm wondering if I'm missing some essential trick for this, I am interested to hear about other methods to achieve this or similar things.

One example is a configuration tool for the Creator Kit DetailsList control that takes a collection for format configuration. 

hjaf_0-1693242686234.png

 

Getting the JSON is simple, but translating this object into a PowerFX object notation is convoluted, the following is the formula for the Refresh buttons (lower right) OnSelect property:

 

With(
 {
 JsonPayload: JSON(
 colDetailsListColumns,
 JSONFormat.IndentFour
 )
 },
 Clear(colJsonPayloadTable);
 ForAll(
 Split(
 JsonPayload,
 ""
 ),
 Collect(
 colJsonPayloadTable,
 {
 CharNo: CountRows(colJsonPayloadTable),
 Char: ThisRecord
 }
 )
 );
 ForAll(
 MatchAll(
 JsonPayload,
 "(\"")([a-zA-Z]+)(\"":)"
 ) As JsonFormatFieldName,
 RemoveIf(
 colJsonPayloadTable,
 CharNo = JsonFormatFieldName.StartMatch - 1// Relative position of the first double quote.
 );
 RemoveIf(
 colJsonPayloadTable,
 CharNo = JsonFormatFieldName.StartMatch + Len(JsonFormatFieldName.FullMatch) - 3// relative position of the second double quote
 )
 );
 UpdateContext(
 {
 locDetailsListConfigurationJson: JsonPayload,
 locDetailsListConfigurationPfx: Concat(
 colJsonPayloadTable,
 Char.Value,
 ""
 )
 }
 );
 Clear(colJsonPayloadTable)
);

 

This works perfectly for basic objects, but I suspect its not supporting complex objects and I believe its going to stall for slightly bigger objects.

I've tried other ways of using MatchAll() and Substitute() / Replace() but, I find it very difficult to debug and keep track of escaping the double quotes etc. Anyone else worked on something similar and have some suggestions on how this can be done differently? 

I have the same question (0)

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 401 Most Valuable Professional

#2
11manish Profile Picture

11manish 201 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard