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

Community site session details

Session Id : 72Wc0fUTxgU7YgxgCtcOP0
Power Automate - Building Flows
Answered

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

Like (0) ShareShare
ReportReport
Posted on 3 Jan 2021 23:50:46 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!)

I have the same question (0)
  • Verified answer
    Janika20192 Profile Picture
    13 on 04 Jan 2021 at 05:17:25
    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,356 Most Valuable Professional on 04 Jan 2021 at 04:51:35
    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 04 Jan 2021 at 04:41:59
    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 04 Jan 2021 at 02:35:21
    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,356 Most Valuable Professional on 04 Jan 2021 at 02:07:19
    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 04 Jan 2021 at 00:56:50
    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,356 Most Valuable Professional on 04 Jan 2021 at 00:24:37
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Tomac Profile Picture

Tomac 986 Moderator

#2
stampcoin Profile Picture

stampcoin 699 Super User 2025 Season 2

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 577 Super User 2025 Season 2