【发布时间】:2020-10-01 06:04:31
【问题描述】:
我需要检查 JSON 对象中是否存在特定关键字,并在此基础上创建一个字符串。我的示例 dataweave 2.0 代码如下:
%dw 2.0
output application/json
var arr = {
"ID": "100",
"ProdId": "Prod",
"ProdName": "ABC"
}
---
if (arr pluck $$ joinBy ';' contains "ProdId") == true
then (String: "Product") else
if (arr pluck $$ joinBy ';' contains "EmpId") == true
then (String: "Employee") else null
根据变量的值,我需要有不同的字符串值。上面需要什么改变才能工作?
【问题讨论】:
标签: mule mule-studio dataweave mule-component anypoint-studio