cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ppl
Post Patron
Post Patron

Append a string to the last element of the array

Hello.

I have the array

[
     {
          "User1": "john@microsoft.com",
          "User2": "bill@microsoft.com"
     },
     {
          "User1": "kate@microsoft.com",
          "User2": "bob@microsoft.com"
     },
     {
          "User1": "sarah@microsoft.com",
          "User2": "jack@microsoft.com"
     }
]

And a string: julia@microsoft.com

I need to add it to the last element of the array:

[
     {
          "User1": "john@microsoft.com",
          "User2": "bill@microsoft.com"
     },
     {
          "User1": "kate@microsoft.com",
          "User2": "bob@microsoft.com"
     },
     {
          "User1": "sarah@microsoft.com",
          "User2": "jack@microsoft.com"
          "User3": "julia@microsoft.com"     
     }
]

How to do that?

1 ACCEPTED SOLUTION

Accepted Solutions
PrasadAthalye
Community Champion
Community Champion

There isnt any direct function for this. Please see following steps.

  • Declare InputArray variable of type array and initialize with original data.
  • Declare Another array variable called FinalArray and Set value as first and second array element from InputArray.
  • Now use Append to Array variable and create third element with new values and append to Final Array.
  • Finally use Compose to see the output.

PrasadAthalye_0-1631656739160.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

1 REPLY 1
PrasadAthalye
Community Champion
Community Champion

There isnt any direct function for this. Please see following steps.

  • Declare InputArray variable of type array and initialize with original data.
  • Declare Another array variable called FinalArray and Set value as first and second array element from InputArray.
  • Now use Append to Array variable and create third element with new values and append to Final Array.
  • Finally use Compose to see the output.

PrasadAthalye_0-1631656739160.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

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.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (3,708)