0
我想發送下面的json請求。有條件地將元素包含在swagger中
{
"outboundMessageRequest": {
"senderAddress": "{senderAddress}",
"charging": {
"description":"{description}",
"amount" : "{amount}"
},
"outboundMessage": {
"subject": "{subject}",
"priority": "{priority}"
}
}
}
我的問題是如果用戶沒有提供描述字段的值,我該如何從請求中移除收費元素?
例如,如果用戶沒有爲描述元素提供值,服務器應該接收下面的json。
{
"outboundMessageRequest": {
"senderAddress": "{senderAddress}",
"outboundMessage": {
"subject": "{subject}",
"priority": "{priority}"
}
}
}