cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kaswiere
Microsoft
Microsoft

Add Object to Json Array

I have some json like this

 

{

   "People":[{"LastName":"Smith", "FirstName":"Tim"}]

}

 

In Power Automate how do I add a new object to the People Array.  I just can't figure this out.

1 ACCEPTED SOLUTION

Accepted Solutions

My apologies. Can you please check if following steps work for you?

 

  1. Declare Array variable and assign People array to it.
  2. Use Append to Array variable and append the element.
  3. Use Compose on array variable and output will show you array with a new element.

PrasadAthalye_0-1613751659296.pngPrasadAthalye_1-1613751711413.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

View solution in original post

3 REPLIES 3
PrasadAthalye
Community Champion
Community Champion

You can use Parse JSON and it will give you a People array... You can click Generate from schema and provide this JSON so that it generates schema

 

PrasadAthalye_0-1613697368974.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

I know how to get the People Array.  What I am having difficulty with is adding an object to this array and updating the json to have this new object.  In my example, I have one element in the People array. I want to add another element so I have two elements in the People Array.

My apologies. Can you please check if following steps work for you?

 

  1. Declare Array variable and assign People array to it.
  2. Use Append to Array variable and append the element.
  3. Use Compose on array variable and output will show you array with a new element.

PrasadAthalye_0-1613751659296.pngPrasadAthalye_1-1613751711413.png

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,424)