Which keyword do you use to create a new function in DataWeave?

Which keyword do you use to create a new function in DataWeave?
A . function
B. fun
C. func
D. map

Answer: B

Explanation:

You can define your own DataWeave functions using the fun declaration in the header of a DataWeave script. Sample is as below. —————————————- %dw 2.0

output application/json

fun toUpper(aString) = upper(aString)



toUpper("hello")

MuleSoft Doc

Ref: https://docs.mulesoft.com/mule-runtime/4.1/dataweave-functions

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments