cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

Combine mutliple JSON results into single JSON object for response step

Hi

 

I have a question about combining two result sets into a single set for a Return step. Goal is to have to only call Flow once rather than twice to get the two result steps, improving performance and cutting down on the number of flow calls.

 

Scenario: Triggering from PowerApps, my flow performs a Project Online - List projects step. This gives me the data I want, except for the URL of any associated project sub webs, so I also perform a Send an HTTP request to SharePoint step specifying the Site Address, Method = Get and Uri is _api/web/webs. From the results of that step I can get the SiteUrl and Title (which matches the name of the project with which the sub web is associated).

 

Question: How to return both data sets (from List Projects and HTTP request to SharePoint) as a single result set in the Response step. I would put this into a collection in PowerApps and would expect it to appear as a two column table/record with the result set from List Projects (as a 'nested table') in one column and the result set from Send an HTTP request (as a 'nested table') in the other.

 

Thanks

Paul

3 REPLIES 3
Super User
Super User

Re: Combine mutliple JSON results into single JSON object for response step

So, I've used a Compose step with a createArray function, passing it to my two existing arrays.

 

This does indeed combine my two arrays, one under the other, e.g.

[
  [
    {
      "Table1Field1": "Bill",
      "Table1Field2": "https://..."
    }
  ],
  [
    {
      "Table2Field1": "Ben",
      "Table2Field2": "35",
"Table2Field3": "some other data" } ] ]

Great!

 

But... I am returning this data to PowerApps in a Request - Response step which means I have to provide a valid schema 😞

 

Pasting the example above into the generate payload option of Request - Response gives a schema only for Table1.

 

I am trying to hand craft a schema which is an array with two arrays within it. After much trial and error I have built the following. Some online tools say this is a valid schema and my Flow runs without complaint, but what I get back in PowerApps is a Collection with one Column named Value and one row with the value of True.

 

{
  "type": "array",
  "items": {
    "Table1": {
      "type": "array",
      "properties": {
        "Table1Field1": {
          "type": "string"
        },
        "Table1Field2": {
          "type": "string"
        }
      }
    },
    "Site": {
      "type": "array",
      "properties": {
        "Table2Field1": {
          "type": "string"
        },
        "Table2Field2": {
          "type": "string"
        },
       "Table2Field3": {
         "type": "string"
        }
      }
    }
  }
}

 

What I want to end up is with a collection with one row and two columns. Column 1 would have the contents of Table1, Column 2 would have the contect of Table2.

 

Any tips as to how I can do this? Is this even possible? (I have used some Cognitive Services connectors which return 'complex' data, as in, nested tables and records into a PowerApps collection, so I believe this should be possible if I could just get the syntax correct).

 

Thanks

Paul

Highlighted
Wauters
Level: Powered On

Re: Combine mutliple JSON results into single JSON object for response step

Hi Paul

 

We currently are facing the same challenge. Any resolution/workaround you found so far?

Super User
Super User

Re: Combine mutliple JSON results into single JSON object for response step

Sorry, never found a satisfactory solution. In the end we resorted to doing two Flows, one for each set of JSON.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (6,085)