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 Automate / 'Apply_to_each_2' fail...
Power Automate
Answered

'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON_autopilot')' is of type 'Object'. The result must be a valid array.

(0) ShareShare
ReportReport
Posted on by 16
Iam getting an error that says 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON_autopilot')' is of type 'Object'. The result must be a valid array. I am trying to process each element of a JSON object. I attached a screenshot of my flow as well as the schema for the parse JSON connector. Does anyone have any ideas what may be causing this?
 
 Screenshot 2023-10-17 154017.pngScreenshot 2023-10-17 154404.png
{
    "type""object",
    "properties": {
        "statusCode": {
            "type""integer"
        },
        "headers": {
            "type""object",
            "properties": {
                "Transfer-Encoding": {
                    "type""string"
                },
                "Vary": {
                    "type""string"
                },
                "Strict-Transport-Security": {
                    "type""string"
                },
                "request-id": {
                    "type""string"
                },
                "client-request-id": {
                    "type""string"
                },
                "x-ms-ags-diagnostic": {
                    "type""string"
                },
                "OData-Version": {
                    "type""string"
                },
                "Date": {
                    "type""string"
                },
                "Content-Type": {
                    "type""string"
                }
            }
        },
        "body": {
            "type""object",
            "properties": {
                "@@odata.context": {
                    "type""string"
                },
                "@@odata.count": {
                    "type""integer"
                },
                "@@odata.nextLink": {
                    "type""string"
                },
                "value": {
                    "type""array",
                    "items": {
                        "type""object",
                        "properties": {
                            "id": {
                                "type""string"
                            },
                            "groupTag": {
                                "type""string"
                            },
                            "purchaseOrderIdentifier": {
                                "type""string"
                            },
                            "serialNumber": {
                                "type""string"
                            },
                            "productKey": {
                                "type""string"
                            },
                            "manufacturer": {
                                "type""string"
                            },
                            "model": {
                                "type""string"
                            },
                            "enrollmentState": {
                                "type""string"
                            },
                            "lastContactedDateTime": {
                                "type""string"
                            },
                            "addressableUserName": {
                                "type""string"
                            },
                            "userPrincipalName": {
                                "type""string"
                            },
                            "resourceName": {
                                "type""string"
                            },
                            "skuNumber": {
                                "type""string"
                            },
                            "systemFamily": {
                                "type""string"
                            },
                            "azureActiveDirectoryDeviceId": {
                                "type""string"
                            },
                            "managedDeviceId": {
                                "type""string"
                            },
                            "displayName": {
                                "type""string"
                            }
                        },
                        "required": [
                            "id",
                            "groupTag",
                            "purchaseOrderIdentifier",
                            "serialNumber",
                            "productKey",
                            "manufacturer",
                            "model",
                            "enrollmentState",
                            "lastContactedDateTime",
                            "addressableUserName",
                            "userPrincipalName",
                            "resourceName",
                            "skuNumber",
                            "systemFamily",
                            "azureActiveDirectoryDeviceId",
                            "managedDeviceId",
                            "displayName"
                        ]
                    }
                }
            }
        }
    }
}
Categories:
I have the same question (0)
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Java_Uzumaki ,

     

    Please try this formula instead

    body('Parse_JSON')?['body']?['value']

      

    vbofengmsft_0-1697592200934.png

     

    Best Regards,

    Bof

     

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 Automate

#1
Haque Profile Picture

Haque 286

#2
David_MA Profile Picture

David_MA 256 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 225 Most Valuable Professional

Last 30 days Overall leaderboard