web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Assign JSON array to g...
Power Automate
Answered

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
    69,039 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
    69,039 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 308

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 226 Most Valuable Professional

Last 30 days Overall leaderboard