Hello I am new to JSON and I have this code that fails if no attachment is uploaded. I need it to cater for no attachment or null values. Appreciate any help on this, thanks.
{
“type”: “array”,
“items”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: “string”
},
“link”: {
“type”: “string”
},
“id”: {
“type”: “string”
},
“type”: {},
“size”: {
“type”: “integer”
},
“referenceId”: {
“type”: “string”
},
“driveId”: {
“type”: “string”
},
“status”: {
“type”: “integer”
},
“uploadSessionUrl”: {}
},
“required”: [
“name”,
“link”,
“id”,
“type”,
“size”,
“referenceId”,
“driveId”,
“status”,
“uploadSessionUrl”
]
}
}
I have updated to cater for null values but still getting the error -
Action ‘Parse_JSON’ failed: Unable to process template language expressions in action ‘Parse_JSON’ inputs at line ‘0’ and column ‘0’: ‘Required property ‘content’ expects a value but got null. Path ‘’.’.
{
“type”: “ParseJson”,
“inputs”: {
“content”: “@body(‘Get_response_details’)?[‘rfb9a982638a64c0db17bc88ea79fe8b3’]”,
“schema”: {
“type”: “array”,
“items”: {
“type”: “object”,
“properties”: {
“name”: {
“type”: [
“string”,
“null”
]
},
“link”: {
“type”: [
“string”,
“null”
]
},
“id”: {
“type”: [
“string”,
“null”
]
},
“type”: {
“type”: [
“string”,
“null”
]
},
“size”: {
“type”: [
“integer”,
“null”
]
},
“referenceId”: {
“type”: [
“string”,
“null”
]
},
“driveId”: {
“type”: [
“string”,
“null”
]
},
“status”: {
“type”: [
“integer”,
“null”
]
},
“uploadSessionUrl”: {
“type”: [
“string”,
“null”
]
}
},
“required”: [
“name”,
“link”,
“id”,
“type”,
“size”,
“referenceId”,
“driveId”,
“status”,
“uploadSessionUrl”
]
}
}
},
“runAfter”: {
“Get_response_details”: [
“Succeeded”
]
},
“metadata”: {
“operationMetadataId”: “2d2a02dd-a342-4ea6-ba7f-2e4ca80343f1”
}
}
Welcome to the Make community!
What is the purpose of this JSON? What are you trying to do with it? JSON is not code, it is simply an object notation to represent things.