cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Appending JSON object.

Hi there i have a JSON like this : 

 

{
"StepData":

[
{

"EstimatedStartDate1.1" : @{utcnow()},

"EstimatedEndDate1.1" : @{utcnow()}}
]
}

 

I need to append more to this json within an apply to each unit i get all the data so it looks like this : 

 

{"StepData":

[
{

"EstimatedStartDate1.1" : @{utcnow()},

"EstimatedEndDate1.1" : @{utcnow()}}

x : x

more : more 

addmore : more 

andmore : more 
]
}

 

any ideas on how to do this ? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Done it using the AddProperty command in Power automate, which will add a new property to a JSON strucure this is already there. 

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Hello @JasonHoffo 

 

Here is an example:

 

I have 3 variables,

JsonData = The main JSON Object Message (Type Json)

ArrayValues = The values I want to add to the main JSON (Type Array)

Jcook_1-1603838912378.png

 

And

temp = variable to convert and manipulate the main JSON (Type Array)

I am using the expression array() to convert the Json message to an Array inside the temp variable. my expression is:

array(variables('JsonData'))

Jcook_2-1603838972135.png

 

 

Next add a 'Apply to each' loop, use the ArrayValues variable as the input.

Now add a 'Append to array variable' action and append the current item to the temp variable

Jcook_3-1603839127236.png

 

Outside the loop, use a 'Compose' action to display the temp variable which will have the full ArrayValues added to the JSON object.

Jcook_4-1603839272402.png

 

Sample Run:

Jcook_5-1603839346677.png

 

 

 

 

 

 

 

 

 

 

 





Did I answer your question? Mark my post as a solution!

If you like my post please hit the Thumbs Up


Proud to be a Flownaut!


Check out my blog for Power Automate tips, tricks, and guides
FlowAltDelete




Highlighted

thankyou for your help, I got to the similar postion.. I need to be able to grab each object with variable[objectname] and then i can get the dates out. I then want to use a coaleace function to make allow if it is empty. So maybe i need all the estimated dates in one long array and then query it directly. I have attempted var[0][estimatedate1] for example and i can get to the first tier [0] but not anything below. 

 

Highlighted

Done it using the AddProperty command in Power automate, which will add a new property to a JSON strucure this is already there. 

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Users online (12,873)