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
10
votes
1 answer

What is the difference between a lazy operator and a stream capable one?

Certain functions and operations in DataWeave seem to execute in a lazy manner, not loading all records at once or only executing when called. At the same time, some seem to support streaming. What's the difference between the two?
afelisatti
  • 2,770
  • 1
  • 13
  • 21
7
votes
8 answers

How to ignore empty objects in DataWeave Mule esb

I am working on transforming my payload. I have got the situation here. Input payload looks like this below one:- { "address": { "city": "bab", "company_name": "asdast", "country_code": "sam", "location": { "city": null, …
Infinity
  • 484
  • 2
  • 8
  • 21
6
votes
7 answers

Dynamic Key Value Pair in DataWeave

DataWeave doesn't like what I'm trying to do with it, and I'm not sure if I'm doing something wrong, or if it is a limitation of DataWeave that isn't possible. Here's the scenario: I'm querying Salesforce and getting two values back: lets call them…
Jaron Thatcher
  • 814
  • 2
  • 9
  • 24
6
votes
1 answer

Mule batch commit and records failures

My current scenario: I have 10000 records as input to batch. As per my understanding, batch is only for record-by-record processing.Hence, i am transforming each record using dataweave component inside batch step(Note: I havenot used any…
5
votes
2 answers

How to Convert hashmap into proper json format in mule 4?

I am trying to log my hashmap it looks something like this : How do I convert it into proper json format ?
iron_man
  • 523
  • 3
  • 13
5
votes
5 answers

logging from inside dataweave

Just like we use inside XSL transformer and system.out.println for datamapper, do we have any logging mechanism for dataweave ? If not a direct component, do we have any other alternate mechanisms to achieve logging from inside…
tortoise
  • 613
  • 1
  • 7
  • 19
4
votes
1 answer

How to compare and merge two JSON objects using Dataweave 2.0

I have a requirement where I need to compare 2 input json objects - obj1 and obj2. Both inputs can have same keys as well as additional key. In case of same keys in both inputs, the values should be fetched from obj2. In case a key is not available…
user7194270
  • 117
  • 2
  • 16
4
votes
1 answer

splitBy regex issue dataweave 2.0

i'm trying to split a dot notated string using splitBy in dataweave 2.0, using a simple regex to avoid splitting escaped strings, testing online the regex works as expected but the dataweave function outputs a different…
John Diaz
  • 341
  • 3
  • 13
4
votes
1 answer

Dataweave (nested) map conditional mapping

Case I have a json object (as imported from excell file, and it needs to be formatted like one as well afterwards). So i can not mess with the structure at all. The input consists of a json formatted object with sheets, every sheet is an array of…
4
votes
1 answer

Dataweave recursion limit?

I have the following DW 2.0 function for trimming white space on any string values in a JSON payload: fun whiteSpaceTrimmer(item) = item match { case is Array -> $ map whiteSpaceTrimmer($) case is Object -> $ mapObject { ($$): $…
4
votes
1 answer

How to obtain XML encoding type?

My current payload is (received from a POST) I want to get the encoding value (ie ISO-8859-1) What is the correct DataWeave expression to use ? I already tested var infos =…
4
votes
1 answer

How to use Excel as a lookup in dataweave

QQ - if I have an Excel spreadsheet on the classpath of a Mule app, can I do a lookup against it using dataweave alone?
machaval
  • 4,969
  • 14
  • 20
4
votes
1 answer

Daylight savings in DataWeave 2.0 dates

is there a way to handle automatically daylight savings? I’m using the following transformation %dw 2.0 output application/json --- {'date': now() >> "EST"} but the output is { "date": "2019-08-08T06:45:16.663-05:00" } The timezone is -05:00,…
Shoki
  • 1,508
  • 8
  • 13
4
votes
1 answer

Why does Mule DataWeave array map strip top level objects?

I'm trying to understand the behaviour of DataWeave v1.0 when it comes to mapping objects in a root JSON array. At this stage I just want to map each item in the array as-is without mapping each individual field of the item. I need to do it for each…
Johnson
  • 451
  • 2
  • 13
4
votes
1 answer

Precedence in multiple DataWeave functions

I'm going through the Mule Dev 1 course and am stumped between module content and what I'm seeing in practice. The module content states that: "When using a series of functions, the last function in the chain is executed first." So filghts orderBy…
1
2 3
99 100