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 / Procedure returns JSON...
Power Apps
Answered

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

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • cchannon Profile Picture
    4,702 Moderator on at

    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

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard