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)
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.
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:
With the variable:
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"
]
}
}
}
}
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.
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.
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.
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional