在Azure逻辑应用程序中,我们如何验证json正文中是否存在任何字段
在我的逻辑中,我期待以下json结构在Azure逻辑应用程序中,我们如何验证json正文中是否存在任何字段,azure,azure-logic-apps,Azure,Azure Logic Apps,在我的逻辑中,我期待以下json结构 { "id": "233343344", "eventSourceId": 124443, "eventSourceUuid": "3655444", "eventTime": "1323", "notificationTime": "2333232&
{
"id": "233343344",
"eventSourceId": 124443,
"eventSourceUuid": "3655444",
"eventTime": "1323",
"notificationTime": "2333232",
"eventType": "appointment-reminder-add",
"notificationType": [
"EMAIL"
],
"transportParameters": [
{
"emailTransportParameters": {
"version": 1,
"toAddress": "abc@gmail.com",
"fromAddress": "xyz@gmail.com",
"fromName": "test",
"templateId": "1233",
"content": [
{
"type": "aa",
"name": "bb",
"value": "ccc"
}
]
}
}
]
}
如果不存在,则需要两个字段。我需要采取其他操作。
我如何在azure logic app中验证字段是否存在以及是否为空
//pseudo-code
if(eventSourceId !=null && eventSourceId.length >0)
您可以使用
coalesce
函数进行测试,如下所示(这里我假设您的数据是通过http触发器发送的
equals(合并(triggerBody()?['eventSourceId','EMPTY'),'EMPTY'),'EMPTY')
当eventSourceId不存在时,这将返回true,如果eventSourceId可以包含空的,则显然不是测试的好选择