cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
u4jaanus
Resolver I
Resolver I

Combine two JSON Arrays to one

Hi,

Running parallel flows, doing fetch data from different sources, result is in same format which is JSON Array, I also had it in String format.

Tried Join (found out its totally different thing), then used concat and end up having two arrays in one JSON object.

 

Any way to combine two arrays into one JSON array please?

 

 

Two Arrays.

[
  {
    "productcode":"IRECP",
    "FreeStock":"5",
    "ExpectedStock":""
  },
  {
    "productcode":"N10001",
    "FreeStock":"0",
    "ExpectedStock":""
    }
]

[
  {
    "productcode":"EK20",
    "FreeStock":"1.00",
    "ExpectedStock":"20.00"
  },
  {
    "productcode":"EL50",
    "FreeStock":"-8.00",
    "ExpectedStock":"299.00"
  }
]

 

Desired Result would be one array containing both arrays.

[
  {
    "productcode":"IRE10030CP",
    "FreeStock":"5",
    "ExpectedStock":""
  },
  {
    "productcode":"NIK10001",
    "FreeStock":"0",
    "ExpectedStock":""
    },

  {
    "productcode":"EK219SV150",
    "FreeStock":"1.00",
    "ExpectedStock":"20.00"
  },
  {
    "productcode":"ELTHMC50",
    "FreeStock":"-8.00",
    "ExpectedStock":"299.00"
  }
]

 

 

Thanks 

1 ACCEPTED SOLUTION

Accepted Solutions
poweractivate
Super User
Super User

@u4jaanus 

 

Try just

 

 

union(array_1,array_2)

 

 

from a Compose action. See if it works.

View solution in original post

4 REPLIES 4
poweractivate
Super User
Super User

@u4jaanus 

 

Try just

 

 

union(array_1,array_2)

 

 

from a Compose action. See if it works.

poweractivate
Super User
Super User

@u4jaanus 

 

We can confirm that 

union(array_1,array_2)

 

works properly.

 

See this example.

 

yvio3uwrf.png

 

assume array_1 and array_2 are in your format.

 

You would define the merging of arrays "array_1" and "array_2" as follows:

 

v01ujhdqwgsaz.gif

 

 

 

In our example we only have one item in our json schema "title" but it would be still applicable in your case or for any similar case.

 

Here is the result (see very bottom of the below screenshot - notice both arrays are merged into one array):

 

vujhdqwgsaz.gif

Hope this helps. 

 

Thank you. Union is what i needed. Is there a source which lists all functions supported in Flow?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,349)