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
Super User
Super User

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
Super User
Super User

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

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Users online (2,496)