web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Merging two JSON array...
Power Automate
Answered

Merging two JSON arrays of the same size

(0) ShareShare
ReportReport
Posted on by 87

Hello folks I have two json array of the same size. 

 

 

 

ARRAY1:

[
{
"Column1": "Main directory1",
"Column2": "Sub directory1"
},

{
"Column1": "Main directory2",
"Column2": "Sub directory2"
},

{
"Column1": "Main directory3",
"Column2": "Sub directory3"
}
]

 

 

 

ARRAY2:

[
{
"Column3": "urlNum1"
},

{
"Column3":"UrlNum2"
},

{
"Column3":"UrlNum3"
}
]

 

 

 

I would like to have output like this:

[
{
"Column1": "Main directory1",
"Column2": "Sub directory1",
"Column3": "urlNum1"
},

{
"Column1": "Main directory2",
"Column2": "Sub directory2",
"Column3":"UrlNum2"
},

{
"Column1": "Main directory3",
"Column2": "Sub directory3",
"Column3":"UrlNum3"
}
]

 

 

 

I am trying with Apply to each or Do Until or Append to variable but I am struggling a lot. Can you help me?

Categories:
I have the same question (0)
  • Verified answer
    CU-18081211-6 Profile Picture
    9,270 Moderator on at

    Hi @dignus93reply ,

    Here is my thoughts. To save some space please follow the number:

    a) Let's initialize some stuff:

    1.gabibalaban_0-1616522499731.png

     

    2.gabibalaban_1-1616522536007.png

     

    3.gabibalaban_2-1616522635473.png

     

    4.gabibalaban_3-1616522654212.png

     

    b) And now, here is the magic 😊 ... 

    gabibalaban_4-1616522806556.png

    Hope it helps !

  • dignus93reply Profile Picture
    87 on at

    Thanks a lot @gabibalaban this works good in this case.

     

    Now let's level up. What if I have the same ARRAY1 as before
    ARRAY1:
    [
    {
    "Column1": "Main directory1",
    "Column2": "Sub directory1"
    },

    {
    "Column1": "Main directory2",
    "Column2": "Sub directory2"
    },

    {
    "Column1": "Main directory3",
    "Column2": "Sub directory3"
    }
    ]

     

    but the ARRAY2 now has more key-values for each record. The length it's still the same of the other
    ARRAY2:
    [
    {
    "Column3": "urlNum1",
    "Column4": "prop1",
    "Column5": "asd1"
    },

    {
    "Column3":"UrlNum2",
    "Column4": "prop2",
    "Column5": "asd2"
    },

    {
    "Column3":"UrlNum3",
    "Column4": "prop3",
    "Column5": "asd3"
    }
    ]


    my desired output follow the same patter as before
    ARRAYOUTPUT:
    [
    {
    "Column1": "Main directory1",
    "Column2": "Sub directory1",
    "Column3": "urlNum1",
    "Column4": "prop1",
    "Column5": "asd1"
    },

    {
    "Column1": "Main directory2",
    "Column2": "Sub directory2"
    "Column3":"UrlNum2",
    "Column4": "prop2",
    "Column5": "asd2"
    },

    {
    "Column1": "Main directory3",
    "Column2": "Sub directory3",
    "Column3":"UrlNum3",
    "Column4": "prop3",
    "Column5": "asd3"
    }
    ]

     

    I guess I can follow your pattern and do this reading the key value manually. But is there a way to loop through ARRAY1 and ARRAY2 in order to have a ARRAYOUTPUT???

    Regards,
    Alessandro

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard