Skip to main content
Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

(0) ShareShare
ReportReport
Posted on by 13

Hi guys,

 

I'm trying to create a flow that triggers when a user checks in a document. Apparently this isn't supported yet by Flow so I have used a work around supplied by a helpful user on these forms here.

 

Here is the code I typed out:

 

 

{
 "type": "object",
 "properties": {
 "d": {
 "type": "object",
 "properties": {
 "OData__ModerationStatus": {
 "type": "integer"
 }
 }
 }
 }
}

 

 

 

Unfortunately that user didn't post the JSON in text format and I had to type it out myself. My flow fails at the "Parse JSON" step with this error message:

 

 

[
 {
 "message": "Invalid type. Expected Object but got Array.",
 "lineNumber": 0,
 "linePosition": 0,
 "path": "",
 "schemaId": "#",
 "errorType": "type",
 "childErrors": []
 }
]

 

 

 

Any help would be greatly appreciated (including any other ways to trigger a flow when a document in a library is checked in!)

  • Verified answer
    Janika20192 Profile Picture
    13 on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    Thanks guys - thanks for being so patient. I think the root of the issue was that I was using a template and editing the initial trigger. When I set the HTTP request URI it was automatically putting it inside an Apply to Each.

     

    I made a new flow from blank and it parses the JSON just fine!

  • Pstork1 Profile Picture
    67,060 Most Valuable Professional on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    Since the trigger fires for each file that is modified you don't need the Apply to each loop.  As you can see from my example with the same trigger I don't have one.

  • ParthaT Profile Picture
    10 on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    Hi,

    I think the problem is the apply to each condition and that the parse to JSON is outside the apply-to each condition. 

    Not sure about the need for apply to each. Refer to @Pstork1  example - You can perhaps have the send an http request immediately after the file modified trigger. If you really need to have the apply to each, then use parse json inside the apply to each instead of outside

    ParthaT_0-1609735214591.png

     

     

  • Janika20192 Profile Picture
    13 on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    I believe I'm using the exact same trigger as you are - see screenshot.

     

    I can see in the error tracker that the data is an object before it is submitted to be parsed, but turns in to an array after it is received by the parser (see second screenshot). Am I misinterpreting that or perhaps that's something to go on?

    2021-01-04 13_31_01-Settings.png

    Screenshot 2

    2021-01-04 13_29_41-Run History _ Power Automate — Mozilla Firefox.png

  • Pstork1 Profile Picture
    67,060 Most Valuable Professional on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    The article was based off using a Get File Properties action, but I'm using the actual trigger properties.  So in my case its not Path, Its Folder Path, since Path isn't available from just the trigger.  Given the error you are getting I suspect you are using Get Files instead of Get File (notice the plural).  That's why it says you are getting an array rather than an object.  Here's what my working flow looks like

    image.png

     

  • Janika20192 Profile Picture
    13 on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    Thanks for the quick reply - here's a screenshot of my HTML call (same as in the post I linked, except for my sharepoint site of course).

     

     

    screenshot of HTML callscreenshot of HTML call

  • Pstork1 Profile Picture
    67,060 Most Valuable Professional on at
    Re: Flow fails when parsing JSON: "Invalid type. Expected Object but got Array"

    This is the JSON schema that works for me when I make the call he is suggesting.  Can you share a screenshot of the HTTP call you are using?

     

    {
        "type": "object",
        "properties": {
            "d": {
                "type": "object",
                "properties": {
                      "CheckOutType": {
                            "type": "integer"
                       }
                   }
            }
    }
    }

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1