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?


{
"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"
]
}
}
}
}
}
}