Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 94gWuXl2eQNoe6ubdAl7Zl
Power Automate - Building Flows
Suggested answer

Append object to array

Like (0) ShareShare
ReportReport
Posted on 11 Dec 2024 17:50:29 by 98
Hi,
I want to get an array like this:
[
  {
    "sender": "Sales",
    "message": "Please clarify",
    "timestamp": "12/11/2024 4:36 PM"
  },
  {
    "sender": "Recipient",
    "message": "This is a risk total.",
    "timestamp": "12/11/2024 4:37 PM"
  }
]

I tried to create Power Automate workflow, but got this:
[
  "{\n    \"sender\": \"Sales\",\n    \"message\": \"Please clarify\",\n    \"timestamp\": \"12/11/2024 4:36 PM\"\n},",
  "{\n    \"sender\": \"Recipient\",\n    \"message\": \"This is a risk total.\",\n    \"timestamp\": \"12/11/2024 4:37 PM\"\n},"
]


This is my flow:



How can I achieve this?







 
  • Suggested answer
    Pstork1 Profile Picture
    66,545 Most Valuable Professional on 11 Dec 2024 at 19:00:59
    Append object to array
    The problem is that the values in the Compose will be interpreted as a String, not a JSON array.  Just declare the array in the Initialize Variable action. That will give you the array you want.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     
  • Suggested answer
    SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 11 Dec 2024 at 18:12:41
    Append object to array
    Hi @xvzms 
     
    Replace this:
    With this the current item:
     
    My results:
     
     
     
  • Suggested answer
    SwatiSTW Profile Picture
    577 Super User 2025 Season 1 on 11 Dec 2024 at 18:09:54
    Append object to array
    In your Power Automate flow, use the "Initialize Variable" action. Set the type to Array and name it something like MyArray.
    Use the "Append to Array Variable" action to add objects to the array. For example:
    {
        "sender": "Sales",
        "message": "Please clarify",
        "timestamp": "12/11/2024 4:36 PM"
    }
    Add another similar action for the next object:
    {
        "sender": "Recipient",
        "message": "This is a risk total.",
        "timestamp": "12/11/2024 4:37 PM"
    }
    Make sure you are adding the objects directly as shown above. Do not enclose them in quotes or use any string-related expressions.
    To confirm, add a "Compose" action after you've appended all objects. Use the array variable MyArray in the "Input" field of the Compose action.
    Run the flow. The output from the "Compose" action should now show an array of objects, not strings.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Automate - Building Flows

#1
David_MA Profile Picture

David_MA 351 Super User 2025 Season 1

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 290 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 278

Overall leaderboard
Loading started