Hi All
I am having issues trying to parse a JSON then store the data in a sql table. Would really appreciate some help on this one.
Error below:
The execution of template action 'Apply_to_each' failed: the result of the evaluation of 'foreach' expression '@body('Parse_JSON')?['body']?['employees']' is of type 'Null'. The result must be a valid array.
My JSON Schema:
{
"type": "object",
"properties": {
"body": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"type",
"name"
]
}
},
"employees": {
"type": "array",
"items": {
"type": "object",
"properties": {
"91": {
"type": "string"
},
"id": {
"type": "string"
},
"employeeNumber": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"jobTitle": {
"type": "string"
},
"customCultureManager2": {},
"customTeamName": {},
"photoUploaded": {
"type": "boolean"
},
"photoUrl": {
"type": "string"
}
},
"required": [
"91",
"id",
"employeeNumber",
"firstName",
"lastName",
"jobTitle",
"customCultureManager2",
"customTeamName",
"photoUploaded",
"photoUrl"
]
}
}
}
},
"statusCode": {
"type": "integer"
},
"headers": {
"type": "object",
"properties": {
"Transfer-Encoding": {
"type": "string"
},
"Connection": {
"type": "string"
},
"Pragma": {
"type": "string"
},
"Strict-Transport-Security": {
"type": "string"
},
"Vary": {
"type": "string"
},
"X-Content-Type-Options": {
"type": "string"
},
"Cache-Control": {
"type": "string"
},
"Date": {
"type": "string"
},
"Server": {
"type": "string"
},
"Content-Type": {
"type": "string"
},
"Expires": {
"type": "string"
},
"Content-Length": {
"type": "string"
}
}
}
}
}
