Power Automate – Get schema of a Power App collection for Parse JSON action

9 steps

Introduction:

We will learn how to get the schema of a Power App collection when using the Parse JSON action. Although we can use 3rd party tools to do this, we will use Power App as a tool to get the sample payload. In this example, we will create 3 separate buttons in Power Apps to demonstrate the steps.


Step 1:

In a blank canvas Power App, insert a button named Button1. Change the following properties:

Text property

"Create Sample Collection"

OnSelect property

ClearCollect(collMyCollection,
Table({City:"Jakarta",Population:10560000},
{City:"Manila",Population:1850000},
{City:"Singapore City",Population:5640000},
{City:"Kuala Lumpur",Population:1980000})
)

Step 2:

Insert another button named Button2. Change the following properties:

Text property

"Convert Collection To JSON"

OnSelect property

Set(varJSON,JSON(collMyCollection,JSONFormat.Compact));

Step 3:

Insert a text label named Label1. Change the following properties:

Text property

varJSON

Step 4:

Insert another button named Button3. Change the following properties:

Text property

"Copy Code"

OnSelect property

Copy(Label1.Text)

Step 5:

Activate play mode. Click on the ‘Create Sample Collection’ button. This will create our collection. In your scenario, you can replace this one with your collection. Note that when clicking the button there is no indication that the collection has been created.


Step 6:

Click on the ‘Convert Collection To JSON’ button. You will notice the some text will show up in the label. This is the result of the conversion of the collection data into JSON.


Step 7:

Click on the ‘Copy Code’ button. This button simply copies the text in the label to your clipboard.


Step 8:

Go back to your flow where the Parse JSON is. Click on ‘Generate from sample’ button.


Step 9:

Since the JSON text is already copied to your clipboard, paste the data into the box. Select the ‘Done’ button afterwards.


Conclusion:

Clicking the ‘Done’ button will review the code that you have pasted and convert it into a schema. You are now able to convert JSON of this structure into something Power Automate can use.


Did this article help? Let us know how we can improve. Send us a message by clicking the “Contact Us” button below.

 

Article last updated on June 7, 2024


Need expert guidance on Power Apps?