web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Append object to array
Power Automate
Suggested Answer

Append object to array

(0) ShareShare
ReportReport
Posted on by 103
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?







 
Categories:
I have the same question (0)
  • Suggested answer
    SwatiSTW Profile Picture
    741 Super User 2025 Season 2 on at
    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.
  • Suggested answer
    SpongYe Profile Picture
    5,616 Super User 2025 Season 2 on at
    Hi @xvzms 
     
    Replace this:
    With this the current item:
     
    My results:
     
     
     
  • Suggested answer
    Pstork1 Profile Picture
    68,725 Most Valuable Professional on at
    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
     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard