Questions tagged [dataweave]

The DataWeave Language is a powerful template engine that allows you to transform data to and from any kind of format (XML, CSV, JSON, Pojos, Maps, etc).

DataWeave is the MuleSoft expression language for accessing and transforming data that travels through a Mule app. DataWeave is tightly integrated with the Mule runtime engine, which runs the scripts and expressions in your Mule app.

DataWeave scripts act on data in the Mule event. Most commonly, you use it to access and transform data in the message payload. For example, after a component in your app retrieves data from one system, you can use DataWeave to modify and output selected fields in that data to a new data format, then use another component in your app to pass on that data to another system.

Full Reference

https://docs.mulesoft.com/mule-user-guide/v/3.7/dataweave-reference-documentation

https://docs.mulesoft.com/mule-runtime/4.2/dataweave

1845 questions
3
votes
2 answers

Mule DataWeave transform-message failing with missing metadata:id attribute

I have a very simple hashmap payload being converted to application/json. I have done this in other flows by just dragging the dataweave component in, and writing the mapping expression. now for some reason, I am getting the following error: The…
Nathan Tregillus
  • 6,006
  • 3
  • 52
  • 91
3
votes
2 answers

Mule: Is it possible to use DataWeave to set flowVars

I am creating a flow that is issuing twitter search request, looping through each tweet, and pushing to a target connector (file, jdbc, etc). There are properties such as the user.screenName, text, and id that I would like to use in more than one…
massnerder
  • 63
  • 1
  • 8
3
votes
2 answers

Stripping Illegal Characters from message Stream in Mule

I have experienced an issue where there was an illegal character in a source system which when it hit the DataWeave transformer threw an error. We have since fixed the data in the source system, however we should be able to strip this illegal…
Bob Jones
  • 49
  • 1
  • 5
3
votes
4 answers

Converting to a date format in Mule using DataWeave

My requirement is to convert a string to a date format using DataWeave in Mule Input string 8/30/2015 4:00:13 PM Output date needs to be in MM/DD/YYYY format i.e, 08/30/2015 i have tried using the below logic (($[1] splitBy " ")[0]) as…
keerthi ch
  • 67
  • 1
  • 3
  • 15
3
votes
1 answer

How can I produce an XML document with a DOCTYPE defined using Mule and DataWeave?

I'd like to create a DataWeave transformation that produces an XML document that includes a DOCTYPE like so:
Ryan Hoegg
  • 2,415
  • 2
  • 14
  • 15
3
votes
2 answers

How do we use a Lookup table in Mule DataWeave

I would like to know how we can define our customer LookUpTable in DataWeave. I am not able to find options to define custom LookUpTable I am looking for some lookup options like how we do it in DataMapper as below Can Someone help me with this
Naveen Raj
  • 801
  • 11
  • 26
2
votes
1 answer

raw is not working incase of retrieving the value form a variable in dataweave 2 mule

I'm just trying to convert the numeric values to strings without losing their decimal values, including zeros. This can be done using the raw operator in DataWeave 2.0. In below I converted a 123.0 numeric value to a "123.0" string value. But when…
Integraty_dev
  • 500
  • 3
  • 18
2
votes
2 answers

Can we run Mulesoft Dataweave code in Java?

Is it feasible to run the Mulesoft dataweave script in Java using any open source libraries ? Mulesoft has announced its open source sometime back, but did not given further details of the libraries. https://blogs.mulesoft.com/news/dataweave/
Imrankhan
  • 31
  • 5
2
votes
1 answer

Mule 4 attributes.maskedRequestPath expected behaviour

The documentation says: Path computed from masking the listenerPath and taking the difference. Note that this is only calculated when the null otherwise. It seems this sentence is not complete so I am unsure of the expected value of…
Pierre
  • 51
  • 8
2
votes
1 answer

Trying to remove first line in a CSV file using Dataweave

My goal is just to use Dataweave to remove the first line ('a') in the below CSV file and then convert CSV to JSON. I can get my Dataweave working online in the Dataweave Playground (https://developer.mulesoft.com/learn/dataweave/) but it will not…
llawliet
  • 125
  • 1
  • 1
  • 5
2
votes
1 answer

Accessing multiple files in a multipart request

Most of the documentation in Mule regarding multipart relates to making a request and not processing an incoming request. I'm looking to receive multiple files in an incoming request as an array and then loop through them to upload to another…
Matt P
  • 147
  • 1
  • 6
2
votes
1 answer

Reverse ordering in Mule4 using Date field

I wanted to do reverse ordering using Date field from highest to lowest (DSC). This question is similar to the below link Reverse ordering in Mule4. Thought small tweaks would make the fix. Tried various ways.Not working. When I try to format date…
star
  • 1,493
  • 1
  • 28
  • 61
2
votes
2 answers

How to flatten nested JSON arrays to single array object

I have 50,000+ json objects buried in nested arrays. I want to pull them out so that they can be in single array. Also these nested arrays are quite random having no pattern. E.g [ [ [ [ [ {"a":1 } ], [ {"b":2 } ] ], [[{"c":3 }]] ] ], [{"d":4 }]…
2
votes
1 answer

Uploading image/pdf to slack channel using Mulesoft Slack Connector

i'm trying to use the mulesoft slack connector to upload a pdf file and a png file to a slack channel but i'm not able to configure the settings correctly to make this work. Has anyone been able to do so successfully? Here is my transform message…
2
votes
2 answers

Mule condense data based on a category

Example below. I've got a set of account numbers, with an account attribute. For each account_number there are three categories, and I would like the sum for each account number based on each balance in DataWeave. Data input [ { …
anonMule
  • 91
  • 2