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
Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Top Solution Authors
Top Kudoed Authors
Users online (1,238)