我当前的实现请求正文不支持可选属性:
如果说phoneHome
是null
,那么想要的行为是JSON
根本不包含该属性,例如我想要的是:
{
"phoneWork": "value here",
"phoneMobile": "value here",
"email": "value here"
}
不是:
{
"phoneHome": "",
"phoneWork": "value here",
"phoneMobile": "value here",
"email": "value here"
}
我尝试遍历事件中的所有元素并仅返回非空值,但我无法使其正常工作。伪代码:
for $i in
(
$input.event_input[1]/xxx_Contact_Work_PHONE__c,
$input.event_input[1]/xxx_Contact_Home_PHONE__c,
$input.event_input[1]/xxx_Contact_Mobile_PHONE__c,
$input.event_input[1]/xxx_Contact_Contact_EMAIL1__c
)
return if ($i = "null")
then do nothing
else add the attribute to a JSON
有没有办法做到这一点?