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 JSON body respo...
Power Automate
Unanswered

Append JSON body responses without parsing

(0) ShareShare
ReportReport
Posted on by 111

I am making a series of API calls via Do..until action.

Each call returns a body response in this form:

[
   {
   "id": "123",
   "status": "CLOSED"
   },
   {
   "id": "456",
   "status": "ACTIVE"
   }
]

 

Ho do I append all the responses without using Parse JSON?

I just want to save the appended results as a .json file in Sharepoint.

The problem is that it's appending the square brackets [] from each response together like this (see problem in red):

[
{
"id": "123",
"status": "CLOSED"
},
{
"id": "456",
"status": "ACTIVE"
}
]
[
{
"id": "999",
"status": "CLOSED"
},
{
"id": "888",
"status": "ACTIVE"
}
]

 

I would like to get this instead (please see comma instead of brackets between the call results:

 

[
{
"id": "123",
"status": "CLOSED"
},
{
"id": "456",
"status": "ACTIVE"
},
{
"id": "999",
"status": "CLOSED"
},
{
"id": "888",
"status": "ACTIVE"
}
]

Categories:
I have the same question (0)
  • Paulie78 Profile Picture
    8,422 Moderator on at

    The calls are returning an array, which is correct from the point of view of an API call that can potentially return more than one result. So I would do this:

     

    1. Create an array variable of your own.
    2. Do your API call.
    3. Append the output to your new variable using the expression first(API_Call_Result). This will get the first (and only hopefully) record from within the returned results, and give you an array of results. 

    Does that make sense?

  • michaelshparber Profile Picture
    111 on at

    Each of my responses returns an array of many results.

    In my sample above there are two results - for each call. So I need total of four results.

    So first() is not enough.

    In real world I have hundreds of results in each call. So I thought of appending it just as variables - but the brackets get in the way...

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    Actually there is a much easier way. Just union the results together.

     

    1. Make an array variable.
    2. Do all of your API calls.
    3. Create a compose which uses a union expression to join all of your results into one array.
    4. Assign the output of the compose to your array variable if you need to (but might not be required).

    Much better solution.

  • michaelshparber Profile Picture
    111 on at

    Union! Awesome! 

    I just need to have to somehow to save this array as a .json file.

    How do I do it without Parsing?

    In File Content - it allows me only to chose string variables, but now I have an array variable...

    Please help @Paulie78 

  • Paulie78 Profile Picture
    8,422 Moderator on at

    Just convert it to a string with an expression like this:

    string(variables('testArray'))

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard