Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

Procedure returns JSON in table's column... how to set as PowerApps Object?

(0) ShareShare
ReportReport
Posted on by

In previous engagement, I used REST API connector to run Stored Procedure (SP) in the database. The PowerApps connectors were OAS file and PowerApps created the object/gallery automatically... easy

 

I my current engagement, the client does not allow me to setup an API Server. I must use PowerAutomate to connect the a on-premise SQL server. 

 

I am less familiar with PowerAutomate,

 

The SP returns a recordset with some columns containing scalar value, on other containing JSON string. The JSON can be a complex object, containing attributes, embedded objects and/or arrays. 

 

I can get PowerAutomate to call the SP, and I see the result. 

 

My challenge is to make the result visible to PowerApps.

 

I tried the "Response" action as described in many tutorial. It works fine to create a JSON array with the scalar column, but the JSON column is seen as a string by PowerApps, event If I described its schema in the Response operation. 

 

This is the example of the Schema I inserted in the Response operation for a very simple test SP: 

 

 

 

{
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "ResultCode": {
 "type": "integer"
 },
 "ResultMessage": {
 "type": "string"
 },
 "FromDatabase": {
 "type": "string"
 },
 "TransactionId": {
 "type": "integer"
 },
 "Payload": {
 "type": "object",
 "properties": {
 "echo": {
 "type": "string"
 }
 }
 }
 },
 "required": [
 "ResultCode",
 "ResultMessage",
 "FromDatabase",
 "TransactionId",
 "Payload"
 ]
 }
}

 

 

 

 

ResultCode, ResultMessage,FromDatabase and TransactionID are scalar columns in the SP RecordSet, Payload contain the JSON object (very simple here, but this is just a test SP to learn the mechanic, in real SP, will be way more complex).

 

As I also write the SP, I do have some flexibility. I could, for exemple, include the scalar columns into the JSON and thus have a recordset of only one column. If the SP returns many records, I could also put them all in the JSON, thus always having a recordset of one record, one column. 

 

I am open to suggestions.

 

Thanks

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Procedure returns JSON in table's column... how to set as PowerApps Object?

    Thanks cchannon,

     

    Your reply is useful, but not sufficient.  It did helped me, but I did not yet solve the entire issue. 

     

    This is what I did to make it work:

    1- Change the Stored Procedure to return a single row, single column recordset. The column (ResultJson) contains a JSON object,

    2- In the flow, after calling the SQL Stored Procedure Action, I added a these steps:

    - Compose with this formula: first(outputs('x')?['body/resultsets/Table1']).ResultJson, which create a single "variable" with the first record's column ResultJson

    - Parse JSON which convert the text output into a JSON object

    - Response which put the JSON object into the Body of the response.

     

    Test the Flow, works fine

     

    Now when I call the Flow from PowerApps, I can Set() a record variable to the procedure output.

     

    Thanks again for your help.

  • cchannon Profile Picture
    4,702 Super User 2025 Season 1 on at
    Re: Procedure returns JSON in table's column... how to set as PowerApps Object?

    Power Automate has a native Parse Json action that you can use to make this easier. You just feed it an example JSON document and it uses that to convert your real JSON to objects.

     

    How to use Parse JSON action in Power Automate - Microsoft Tech Community

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 85 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 57 Super User 2025 Season 1

#3
mmbr1606 Profile Picture

mmbr1606 55 Super User 2025 Season 1

Overall leaderboard