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 Automate / Merging 2 arrays of ob...
Power Automate
Suggested Answer

Merging 2 arrays of objects

(0) ShareShare
ReportReport
Posted on by 47
Hi All
 I got 2 arrays of objects :
   [{"Answer":1,"Answered":true,"CQID":"C10Q62","CompID":10,"QID":"62","Weight":3},
     {"Answer":0,"Answered":true,"CQID":"C10Q63","CompID":10,"QID":"63","Weight":2},
      {"Answer":1,"Answered":true,"CQID":"C10Q64","CompID":10,"QID":"64","Weight":2}       ] 
and 
  [{"QID":"62","Ddescription":"Some description for item question 62"},
     {"QID":"63","Ddescription":"Some description for another item"},
      {"QID":"64","Ddescription":"Description for item question 64"}   ] 
the question is - whats the quickest way to add Descriptions from second array to items in a first array, matched by QID, to get 
 [{"Answer":1,"Answered":true,"CQID":"C10Q62","CompID":10,"QID":"62","Weight":3,"Ddescription":"Some description for item question 62"},
     {"Answer":0,"Answered":true,"CQID":"C10Q63","CompID":10,"QID":"63","Weight":2,"Ddescription":"Some description for another item"},
      {"Answer":1,"Answered":true,"CQID":"C10Q64","CompID":10,"QID":"64","Weight":2,"Ddescription":"Description for item question 64"}   ] 
 without ForEach ?
Thanks
 
     
 
Categories:
I have the same question (0)
  • Suggested answer
    sandeepstw Profile Picture
    312 Moderator on at
    You can do using these steps -
    Initialize a array variable name firstArray using first array values. Example  -
    [
      {"Answer":1,"Answered":true,"CQID":"C10Q62","CompID":10,"QID":"62","Weight":3},
      {"Answer":0,"Answered":true,"CQID":"C10Q63","CompID":10,"QID":"63","Weight":2},
      {"Answer":1,"Answered":true,"CQID":"C10Q64","CompID":10,"QID":"64","Weight":2}
    ]
    Then also initilize secondArray with 2nd array values - 
    [
      {"QID":"62","Ddescription":"Some description for item question 62"},
      {"QID":"63","Ddescription":"Some description for another item"},
      {"QID":"64","Ddescription":"Description for item question 64"}
    ]
    then add select action in from use secondArray variable and map values 
    Key: item()?['QID']
    Value: item()?['Ddescription']
    You will get output like - 
    {
      "62": "Some description for item question 62",
      "63": "Some description for another item",
      "64": "Description for item question 64"
    }
    then again use select action to merge both arrays. 
    From: Select firstArray variable.
    Map: Use the following mappings:
    Answer: item()?['Answer']
    Answered: item()?['Answered']
    CQID: item()?['CQID']
    CompID: item()?['CompID']
    QID: item()?['QID']
    Weight: item()?['Weight']
    Ddescription: body('Select')?[item()?['QID']]
    you will get output like 
    [
      {
        "Answer": 1,
        "Answered": true,
        "CQID": "C10Q62",
        "CompID": 10,
        "QID": "62",
        "Weight": 3,
        "Ddescription": "Some description for item question 62"
      },
      {
        "Answer": 0,
        "Answered": true,
        "CQID": "C10Q63",
        "CompID": 10,
        "QID": "63",
        "Weight": 2,
        "Ddescription": "Some description for another item"
      },
      {
        "Answer": 1,
        "Answered": true,
        "CQID": "C10Q64",
        "CompID": 10,
        "QID": "64",
        "Weight": 2,
        "Ddescription": "Description for item question 64"
      }
    ]
    "Select" action to map over the firstArray and add the Ddescription from the dictionary created from secondArray

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

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 167

#3
Haque Profile Picture

Haque 154

Last 30 days Overall leaderboard