无法将 flowVars 设置为 Json 请求中的键

Unable to Set flowVars as Key in Json Request

我正在尝试从 flowVar 为 json 设置键值。它在 dataweave 2.0 中不起作用。我可能遗漏了一些东西(语法)。我有一个具有价值的变量测试。 Dataweave 代码如下所示。

%dw 2.0
output application/json
---
{
    vars.test: "hi"
}

如果是动态的,你需要use parenthesis around the key:

%dw 2.0
output application/json
---
{
    (vars.test): "hi"
}