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
MPA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,702)