Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

When Building an array......

(0) ShareShare
ReportReport
Posted on by 56

I am building an array (i think) to be parsed later and i'm questioning the structure that I've used, specifically, how i'm separating 'entry1' from 'entry2'

 

This is the format i'm looking to achieve in the "ROLLINGUPDATE" field

[{"Date":"SOMEDATE"},{"Time":"SOMETIME"},{"By":"SomePerson"},{"Update":"UPDATES go here"}]

[{"Date":"SOMEDATE"},{"Time":"SOMETIME"},{"By":"SomePerson"},{"Update":"UPDATES go here"}]

[{"Date":"SOMEDATE"},{"Time":"SOMETIME"},{"By":"SomePerson"},{"Update":"UPDATES go here"}]

 

So i currently have

image.png

 

and if conditions match, i would append to that variable with the contents of the rolling update field

image.png

 

 

Which currently gives me

[{"Date":"10-Mar-2020"},{"Time":"03:32:57"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:32:49"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:32:39"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:28:30"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:28:23"},{"By":"TestPerson"},{"Update":"First Update"}],
[{"Date":"10-Mar-2020"},{"Time":"03:28:17"},{"By":"TestPerson"},{"Update":"First Update"}],

 

 

 

Is my format correct? Specifically i'm wondering about the comma at the end of each line - i'm just not sure if that is appropriate

 

 

FYI, if it helps, this is my parsing format

 

{
    "type": "array",
    "items": {
"type": "object",
        "properties": {
            "Date": {
                "type": "string"
            },
            "Time": {
                "type": "string"
            },
            "By": {
                "type": "string"
            },
            "Update": {
                "type": "string"
            }
        },
        "required": []
    }
}
 
Thanks!

 

  • efialttes Profile Picture
    14,756 on at
    Re: When Building an array......
    Hi!
    Is this issue solved? If so, please remember to mark the key reply as a solution, so it will help others in the future
    Thanx!
  • efialttes Profile Picture
    14,756 on at
    Re: When Building an array......
    Hi
    Many common action blocks (sharepoint gat items, lanner get tasks, excel get rows...) provide an putput in json format (object), but one of ita main properties is an array with object elements inside. In such context, each object element is a representation of one SP item, one Planner task, one Excel row. And the SP list column values for such item, the Planner task properties for that task, the Excel column values for that row are represented as properties of the object
    Hope this helps
  • thuff Profile Picture
    56 on at
    Re: When Building an array......

    hi @efialttes ,

     

    That is supremely helpful and both make a lot of sense. entertaining reads. After i read those i thought 'oh i just need to join objects' but now after reading the articles again, i think i need to parse objects , grab the body as an array, append to array.

     

    Or perhaps there is such thing as just append to object? 

  • efialttes Profile Picture
    14,756 on at
    Re: When Building an array......

    Hi again

    Your new approach sounds more common nowadays.

    Since you get confused sometimes with arrays and objects, I would recommentd the following link for better understanding of arrays...

    https://sharepains.com/2018/07/10/microsoft-flow-shed-some-light-on-arrays/

    ...and this other link for better understanding of objects in JSON format

    https://sergeluca.wordpress.com/2017/11/23/using-json-in-microsoft-flow-part-1/

    Please note this second link has a typo, when Serge says:

    • Add a compose action of type Object.
    • Name the variable ‘Pilots’.
    • Paste the following JSON object...

    ...what he really wants to say is:

    • Add a Initialize Variable of type Object.
    • Name the variable ‘Pilots’.
    • Paste as its Value the following JSON object...

    Hope this helps

  • thuff Profile Picture
    56 on at
    Re: When Building an array......

    Thank you @abm and @efialttes ,

     

    Clearly I was confused on the structures. I have long had a basic misunderstanding between arrays & objects - i think i recall the key difference being that (by and large) arrays assume order and objects do not. For these purposes, i think ( and i'm willing to be wrong!) that restating the variables as arrays is the logical approach and start by redefining the structure of that first variable  as object. e.g. 

     

     

    {"Date":"@{formatDateTime(utcNow(),'dd-MMM-yyyy')}","Time":"@{formatDateTime(utcNow(),'HH:mm:ss')}","By":"TestPerson","Update":"@{triggerBody()?['Status_x0020_Update']}"}

     

     

     

    I will play with this and let you know - thank you both (and please let me know if that sounds crazy!) 

  • abm abm Profile Picture
    32,492 Most Valuable Professional on at
    Re: When Building an array......

    Hi @thuff 

     

    Yes that comma will be an issue. So to overcome you could initialise an integer count and check if counter > 1 then  in your Append string use expression concat with comma and rollingupdate else just use the rollingupdate. Also make sure in your initialise WeeklyUpdateString do not use any comma at the end.

     

    Thanks

  • efialttes Profile Picture
    14,756 on at
    Re: When Building an array......

    Hi

    What I would expect inside an array is a number of similar elements. In your case you are adding objects (that's fine) but each of them have different properties.

     

    Also if you want to create an array via 'Initialize variable' my suggestion is to select as its type 'Array' instead of 'String'.

    Please also note there is an action block called 'Append to array variable' that should be used if you declare your variable as array.

     

    An array cannot end with a comma.

    Commas shall separate the different elements of an array.

    Hope this helps

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

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

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1