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 Apps / Returning list of file...
Power Apps
Unanswered

Returning list of files to PowerApps

(1) ShareShare
ReportReport
Posted on by 6

Hi, 

I am quite new to PowerApps, have read many forums on how to return JSON back to PowerApps
However, when trying to use Power Automate to get the file contents of a folder in SharePoint and then returning back to PowerApps to be displayed in gallery the contents. However, when i put 

 

Set(response, Test.Run());

 

It gives the error:

Error.(JSON parsing error, expected 'object' but got 'array'

 

I've double checked the schema and everything seems correct, anyone knows why its not working?

I have attached the image of the flow.

Screenshot 2024-07-02 203242.png
Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @NCF35 ,

    in the response body schema, the type is an object that's why you are getting the object back not array one more thing you should use collect function to store array response

  • NCF35 Profile Picture
    6 on at

    Hi @anandm08 ,

    I tried ClearColllect and Collect based on your suggestion, still same error. 

    Screenshot 2024-07-02 211539.png
    Screenshot 2024-07-02 211509.png
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    have you changed the 1st that is type of schema to array if not try to generate from a sample that I have marked in  2nd in my screenshort.

    Screenshot_20240703_100810.png

  • NCF35 Profile Picture
    6 on at

    Hi  @anandm08,
    Unfortunately, that didnt solve my issue either

    Sample of Body(contents censored):

    {
    "Name": "xxxxx.pdf",
    "Path": "/Shared Documents/xxxx/xxxxx.pdf",
    "IsFolder": false
    }


    Heres the json schema:

    {
        "type": "object",
        "properties": {
            "Name": {
                "type": "string"
            },
            "Path": {
                "type": "string"
            },
            "IsFolder": {
                "type": "boolean"
            }
        }
    }

    I also tried a method where you add [] to have certain fields required:
    Json Schema Generated:
    {
        "type": "array",
        "items": {
            "type": "object",
            "properties": {
                "Name": {
                    "type": "string"
                },
                "Path": {
                    "type": "string"
                },
                "IsFolder": {
                    "type": "boolean"
                }
            },
            "required": [
                "Name",
                "Path",
                "IsFolder"
            ]
        }
    }
     
    I tried both of this with ClearCollect, Collect, and also Set, all not working unfortunately.
    I also tried changing the thing from "object" to "array" still same issue.
    still 
    Error.(JSON parsing error, expected 'object' but got 'array'
    Is there any other reason this could be happening?

     

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 Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard