-1

Do I have a JSON object that looks like:

{"application":{"desiredState":"STOPPED"}}

I need to create this object at runtime in DataWeave based on the value of desiredState passed at runtime which could be STOPPED or STARTED.

How can I do that in DataWeave 2.0 ?

aled
  • 21,330
  • 3
  • 27
  • 34
Andy
  • 51
  • 1
  • 8

1 Answers1

0

It seems that you want just to pass the value from the flow which I'll assume it is passed to the DataWeave script in a variable of the same name.

%dw 2.0
output application/json
---
{"application": {"desiredState":vars.desiredState}}
aled
  • 21,330
  • 3
  • 27
  • 34
  • I realized it later that I didn't have to build the the whole JSON and just pass the desiredState value to the existing json structure – Andy Aug 26 '22 at 15:14