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 / Assign JSON array to g...
Power Automate
Unanswered

Assign JSON array to gallery not working when assigning a variable

(0) ShareShare
ReportReport
Posted on by 6

I'm creating the JSON array in a variable and then including that in the response body. (substring is just to strip the final line break and comma, cause that append is in a loop)

 

PColley_0-1661992746357.png

 

If I show that 'galleryItems' variable (including the substring) in a label, then copy and paste the data into the array as raw data - the gallery populates as expected.

 

PColley_1-1661992896590.pngPColley_2-1661992965874.png

 

However, when I assign the exact same var to be the array in the JSON the gallery table shows as empty. Any ideas about what I'm missing?

 

With raw data:

PColley_3-1661993150868.png

 

With the variable:

PColley_4-1661993227767.png

 

Edit. just in case it helps this is the schema for the response action:

{
 "type": "object",
 "properties": {
 "json": {
 "type": "string"
 },
 "responseCode": {
 "type": "string"
 },
 "galleryItems": {
 "type": "array",
 "items": {
 "type": "object",
 "properties": {
 "fileName": {
 "type": "string"
 },
 "fileUrl": {
 "type": "string"
 }
 },
 "required": [
 "fileName",
 "fileUrl"
 ]
 }
 }
 }
}
Categories:
I have the same question (0)
  • Verified answer
    Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    Remove the comma from the end of the object in the Append to array statement and then skip using the substring.  Append to Array will automatically supply the commas between the objects you are appending so you don't need to supply them and then don't need to strip the last one off.  Make sure the variable type is actually array and that you are using the append to array action, not append to string.

  • PColley Profile Picture
    6 on at

    Thanks so much Paul, only other thing was I had to remove the square brackets from my response body now that I've updated that variable to be an array as they're already included.

     

    Everything you suggested makes perfect sense I was just burned out on debugging I suppose and a little green to Power Apps. Really appreciate your response and all your other responses to questions I have used along the way.

  • Pstork1 Profile Picture
    68,707 Most Valuable Professional on at

    Sorry I missed the square brackets.  Yes you would need to remove that also.  You were treating the JSON array as though it were string data, but if you use an array variable its already in JSON array format internally so no string manipulation is needed.

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