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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Display JSON array in gallery

(4) ShareShare
ReportReport
Posted on by 362
Hello!
 
I have set up a simple flow that returns the following JSON:
 
[
{
"id": "Wakefield.7",
"partitionKey": "Italy",
"Country": "Italy",
"parents": [
{
"familyName": "Wakefield",
"firstName": "Robin"
},
{
"familyName": "Miller",
"firstName": "Ben"
}
],
"children": [
{
"familyName": "Merriam",
"firstName": "Jesse",
"gender": "female",
"grade": 8,
"pets": [
{
"givenName": "Goofy"
},
{
"givenName": "Shadow"
}
]
},
{
"familyName": "Miller",
"firstName": "Lisa",
"gender": "female",
"grade": 1
}
],
"address": {
"state": "NY",
"county": "Manhattan",
"city": "NY"
},
"isRegistered": false,
"_rid": "OftWAObFzHYDAAAAAAAAAA==",
"_self": "dbs/OftWAA==/colls/OftWAObFzHY=/docs/OftWAObFzHYDAAAAAAAAAA==/",
"_etag": "\"00003401-0000-3200-0000-67a111f00000\"",
"_attachments": "attachments/",
"_ts": 1738609136
}
]
 
The sample is an array, which I seem to struggle displaying in PowerApps.
I tried adding a Text Input field, and pasting the JSON in there, then displaying that in a Gallery, and that seems to be working just fine by adding this to the Items of the gallery: 
Table(ParseJSON(TextInput.Text))
 
However, when I try to get the items from a flow, I am facing a bit of an issue, and I am not quite understanding how I can manage to display these items in a gallery.
ClearCollect(myCollection, GetAllItems.Run()) gives me an error saying "JSON parsing error, expected 'object' but got 'array'"
Then I tried doing 
ClearCollect(myCollection, Table(Getallitems.Run()))
That gives me a table in my PowerApps variables, but when I add myCollection to the items of the gallery, and then try to display the id in a label, I get the same JSON parsing error.
 
How can I display the data in this JSON array in a Gallery?
Categories:
I have the same question (0)
  • Suggested answer
    Anthony Blake Profile Picture
    3,092 Super User 2026 Season 1 on at
    Hi @Hagru
     
    Please could you try adding ".value":
     
    ClearCollect(myCollection, GetAllItems.Run().value)
     
    Anthony
  • Hagru Profile Picture
    362 on at
     
    Adding .value after .Run() still gives me the same JSON parsing error, unfortunately.
  • danrobson Profile Picture
    7 on at
    Did you find a solution, running in to the same issue! 
  • Verified answer
    Hagru Profile Picture
    362 on at
     
    I did find a solution, and probably should've updated the post, but it's good that I get the chance to do it now!
     
    I believe the simplest way to do this is probably to use the Response action in your Power Automate flow, add a status code, your JSON body, and paste your resulting JSON into the "Generate from sample" bit and generate the schema (If you don't already have this, just run the flow once, copy the output, click the "Generate from sample" button, and paste it in). Then when you do "ClearCollect(yourCollection, yourFlow.Run())" you should get an already parsed JSON into your table, and be able to put "yourCollection" into the Items property of your gallery, and use ThisItem.Name for example in your gallery label. Adding a screenshot of the response action, just for reference. You won't need a "Respond to PowerApp" or anything after this action, as this action will work in the same way.
     
     
     
    This is how I ended up solving it before I learned about the Response action, just to give another option. However I do not recommend this, as it is a lot more manual work. What made this difficult at the time was that the JSON I got was just an array of objects, and not an object with an array inside, which was kind of new to me. So the response from the API was kind of similar to this:
     
    {
    "statusCode": 200,
    "headers": {}
    "body": [
    {object},
    {object},
    {object}
    ]
    }
     
    And then I just returned the Body with the "Respond to PowerApps" action, and got only an array in return. I believe the Response action would handle this, but in case it doesn't.. The way you handle this in PowerApps is as follows:
     
    // 1. Run flow and save result in variable
    Set(
    varResult,
    myFlow.Run()
    );
     
    // 2. Parse JSON to a collection
    ClearCollect(
    myCollection,
    ForAll(
    Table(ParseJSON(varResult.tableObject)),
    {
    id: Value.id,
    name: Value.name,
    age: Value.age,
    nickname: Value.nickname,
    // Object
    address: {
    city: Value.address.city
    street: Value.address.street,
    zipCode: Value.address.zipCode
    },
    // Table
    pets: ForAll(
    Table(Value.pets),
    {
    animal: Value.animal,
    color: Value.color,
    age: Value.age
    }
    )
    }
    )
    );
     
     
     
    You might need to put all the "Value.item"'s inside a Text() or Boolean() to get the right type. For example Text(Value.name).
    If you have a table inside a table, you will need to nest in another ForAll(Table(Value.anotherTable), Text(Value)).
     
    Please try the Response action first, as that is by far the easiest way to go. I just wanted to add the way I solved it as an alternative.
     
     
    EDIT: I just tested the Response action with the JSON i had the issue with. Testing the flow and pasting the output to generate a schema gave my a schema that PowerApps wouldn't understand, and I got the same error as in the original post. I asked ChatGPT to give me a schema PowerApps would understand, and it gave me a schema I could paste directly into the "Response Body JSON Schema" of the Response Action. When doing "ClearCollect(myCol, myFlow.Run())" and added myCol to the gallery, it worked perfectly.
     
    Also, if you don't find the Response Action when you search for it, it lies under "Request", so just click that, and you will find it.
     

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 Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 174

#2
ManoVerse Profile Picture

ManoVerse 58 Super User 2026 Season 1

#3
Niki Patel Profile Picture

Niki Patel 42

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans