我有这个作为输入:"keys":[{"key":"key1","value":"testKey1"},{"key":"Key2","value":"testKey2"}]
我想要做的是以 json 格式获取此输出:
{ "key1": "testKey1",
"key2":testKey2}
我正在尝试在 mule 中使用 DataWeave 转换器:
%dw 1.0
%output application/json skipNullOn="everywhere"
---
{
price: payload.price,
"": payload.keys filter $.value !=null
}
但它显示了这个:
"": [
{
"value": "key1",
"key": "testKey1"
},
{
"value": "key2",
"key": "testKey12"
}
]
有任何想法吗?