notes=(payload.examples if payload.examples != null else “ “) ++ (\n\n**column1:\ntest: “ ++ vars.name) ++ ( “\n column2: “ ++ vars.date) ++ (“\n column3: “ ++ attributes.headers.speech)
这是DataWeave 2.0,但错误表示输入无效。有人知道如何在m子4中解决此问题吗?
根据你的DataWeave 1.0的注释代码。请找到以下相应的DataWeave 2.o代码。
%dw 2.0
output application/json
---
{
(payload mapObject (value, key) -> {
((key): value) if (key as String != "notes")
}),
notes:
if (payload.examples != null)
payload.examples
else
"" ++ ("\n\n**column1:\ntest: " ++ vars.name) ++ ("\n column2: " ++ vars.date) ++ ("\n column3: " ++ attributes.headers.speech)
}