你如何在 Dataweave 中使用变量作为键

How do you use variable as key in Dataweave

output application/json

var name = vars.uname
---
{
    
   vars.name: name, //-----> Here i am not able too retreive variable as key
   
   description: payload.text
    
    }

for reference

您需要在键中使用括号来指定它是一个表达式。

output application/json

var name = vars.uname
---
{
    
   (vars.name): name, //-----> Here i am not able too retreive variable as key
   
   description: payload.text
    
}