SlideShare a Scribd company logo
 The Data Weave 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).
 The Header, which defines directives
(optional)
 The Body, which describes the output
structure
 The two sections are delimited by a
separator, which is not required if no header
is present. The separator consists of three
dashes: "---"
 This code describes a conversion from a JSON
input to an XML output:
%dw 1.0
%input application/json
%output application/xml
---
{
user: {
name: payload.user_name,
lastName: payload.user_lastName
}
}
 If Output is other than Json , then just replace
Json to required form like XML, CSV etc. in
the header part :
%input application/json
• Payload attribute is the input data and
each field should be separated by
comma :
name: payload.user_name,
lastName: payload.user_lastName
<?xml version="1.0" encoding="UTF-8"?>
<user>
<name> userNameFromPayload </name>
<lastName>
lastNameFromPayload</lastName>
</user>
 The sample output for the example shown
above looks like : (Json format)
{
"user_name": “userNameFromPayload",
"user_lastName": " lastNameFromPayload“
}
 The DataWeave header contains the directives,
which define high level information about your
transformation. The structure of the Header is a
sequence of lines, each with its own Directives.
The Header is terminated with '---'.
 All directives are declared on the header section
of your DataWeave document and act upon the
entire scope of it.
 Directives are a mechanism to declare variables
and constants and namespace aliases which need
to be referenced in the Document. They are also
needed to declare the type of the output of your
transform.
 DataWeave version
 Input types and sources
 Output type
 Namespaces to import into your transform
 Constants that can be referenced throughout
the body
 Functions that can be called throughout the
body
Version Directive : Namespace Directive :
 Through this directive,
you specify the version
of the DataWeave
syntax that is used to
interpret the
transformation.
 coded as : %dw 1.0
 This directive associates
an alias with its
subsequent URI. The
directive is relevant only
when either the input or
the output is of type
XML.
 Coded as : %namespace
mes
http://www.mulesoft.co
m/anypoint/SOA/messag
e/v1.0
Input Directive : Valid input types are :
 Inputs are declared by
assigning a name and a
content type. You can
then refer to them in any
part of the DataWeave
body through the names
defined in the directive.
 Coded as : %input
payload application/xml
 application/json
 application/xml
 application/java
 application/csv
 application/dw
 text/json
 text/xml
 text/csv
 When defining an input of type CSV, there are a
few optional parameters you can add to the input
directive to customize how the data is parsed.
These are not defined in the DataWeave script
but on the Mule XML code, in the Transform
Message XML element.
 There are two ways to achieve this :
 Manually add the attributes to the project’s XML
 graphical interface, by selecting the element from
the tree view in the input section and clicking the
gear icon
Output Directive : Valid output types are :
 The Output Directive
specifies what the output
type is in a
transformation, which is
specified using
content/type. Only one
output can be specified,
the structure of this
output is then defined in
the DataWeave body.
 Coded as :
%output application/xml
 application/json
 application/xml
 application/java
 application/csv
 application/dw
 text/json
 text/xml
 text/csv
 Whenever the output is of XML or JSON type and has null
values in its elements or attributes, you can specify
whether this generates an outbound message that
contains fields with "null" values, or if these fields are
ignored entirely. This can be set through an attribute in
the output directive named skipNullOn, which can be set
to three different values: elements, attributes,
or everywhere.
 Like : %output application/xml skipNullOn="everywhere“
When set to:
 elements: A key:value pair with a null value is ignored.
 attributes: An XML attribute with a null value is skipped.
 everywhere: Apply this rule to both elements and
attributes.
 DataWeave uses three basic data types:
Objects, Arrays, and Simple Types, the
execution of a DataWeave transformation
always produces one of these three types of
data.
 This expression can be built using any of the
following elements:
 Objects
 Arrays
 Simple literals
 Variable and Constant references
 Input
<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
%dw 1.0
%output application/dw
---
payload
Output :
{
note: {
to: "Tove",
from: "Jani",
heading: "Reminder",
body: "Dont forget me this weekend!“
}
}
Still many to learn … Stay tuned!!!!!!!!!!!!

More Related Content

What's hot

Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)
Muhammed Thanveer M
 
Php forms
Php formsPhp forms
Php forms
Anne Lee
 
4 informatica transformation types sq and exp
4 informatica transformation types sq and exp4 informatica transformation types sq and exp
4 informatica transformation types sq and exp
Ravindra Gangwar
 
11i&r12 difference
11i&r12 difference11i&r12 difference
11i&r12 difference
venki_venki
 
Honeywell PLC ML-200R Instruction Basics
Honeywell PLC ML-200R Instruction BasicsHoneywell PLC ML-200R Instruction Basics
Honeywell PLC ML-200R Instruction Basics
Shivam Singh
 
Mule mel 5_tips
Mule mel 5_tipsMule mel 5_tips
Mule mel 5_tips
kunal vishe
 
Javascript Road Trip(es6)
Javascript Road Trip(es6)Javascript Road Trip(es6)
Javascript Road Trip(es6)
Ahmed Assaf
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint development
Pranav Sharma
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
Mudasir Syed
 
html forms
html formshtml forms
html forms
ikram niaz
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
plsql tutorialhub....
plsql tutorialhub....plsql tutorialhub....
plsql tutorialhub....Abhiram Vijay
 
Using SP Metal for faster share point development
Using SP Metal for faster share point developmentUsing SP Metal for faster share point development
Using SP Metal for faster share point developmentPranav Sharma
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
ProdigyView
 
Database Overview
Database OverviewDatabase Overview
Database Overview
Livares Technologies Pvt Ltd
 
Internet Environment
Internet  EnvironmentInternet  Environment
Internet Environmentguest8fdbdd
 
Chapter 07 ddl_sql
Chapter 07 ddl_sqlChapter 07 ddl_sql
Chapter 07 ddl_sql
Nazir Ahmed
 

What's hot (20)

Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)Statements,joins and operators in sql by thanveer danish melayi(1)
Statements,joins and operators in sql by thanveer danish melayi(1)
 
Php forms
Php formsPhp forms
Php forms
 
4 informatica transformation types sq and exp
4 informatica transformation types sq and exp4 informatica transformation types sq and exp
4 informatica transformation types sq and exp
 
11i&r12 difference
11i&r12 difference11i&r12 difference
11i&r12 difference
 
Honeywell PLC ML-200R Instruction Basics
Honeywell PLC ML-200R Instruction BasicsHoneywell PLC ML-200R Instruction Basics
Honeywell PLC ML-200R Instruction Basics
 
Mule mel 5_tips
Mule mel 5_tipsMule mel 5_tips
Mule mel 5_tips
 
Les25
Les25Les25
Les25
 
Javascript Road Trip(es6)
Javascript Road Trip(es6)Javascript Road Trip(es6)
Javascript Road Trip(es6)
 
Using SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint developmentUsing SPMetal for faster SharePoint development
Using SPMetal for faster SharePoint development
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 
html forms
html formshtml forms
html forms
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
plsql tutorialhub....
plsql tutorialhub....plsql tutorialhub....
plsql tutorialhub....
 
PHP Making Web Forms
PHP Making Web FormsPHP Making Web Forms
PHP Making Web Forms
 
Using SP Metal for faster share point development
Using SP Metal for faster share point developmentUsing SP Metal for faster share point development
Using SP Metal for faster share point development
 
HTML Forms Tutorial
HTML Forms TutorialHTML Forms Tutorial
HTML Forms Tutorial
 
Database Overview
Database OverviewDatabase Overview
Database Overview
 
Internet Environment
Internet  EnvironmentInternet  Environment
Internet Environment
 
Chapter 07 ddl_sql
Chapter 07 ddl_sqlChapter 07 ddl_sql
Chapter 07 ddl_sql
 
Sql select
Sql select Sql select
Sql select
 

Viewers also liked

Humerus Başı çıkığı
Humerus Başı çıkığıHumerus Başı çıkığı
Humerus Başı çıkığı
gopacil
 
Story telling. Tom Sawyer
Story telling. Tom Sawyer Story telling. Tom Sawyer
Story telling. Tom Sawyer
selarom7
 
19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...
19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...
19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...
The Business Council of Mongolia
 
Multi-Team Development w Ember, Angular, Knockout etc @ Interactive Intelligence
Multi-Team Development w Ember, Angular, Knockout etc @ Interactive IntelligenceMulti-Team Development w Ember, Angular, Knockout etc @ Interactive Intelligence
Multi-Team Development w Ember, Angular, Knockout etc @ Interactive Intelligence
Todd Jordan
 
ЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗ
ЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ  КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ  КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗ
ЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗ
ibrahimkoncak
 
Apresentação Ganhe Rapido
Apresentação Ganhe RapidoApresentação Ganhe Rapido
Apresentação Ganhe Rapido
jhonny tafarel
 
29.01.2014 regulation on licensing and undertaking custodian’s activities eng
29.01.2014 regulation on licensing and undertaking custodian’s activities eng29.01.2014 regulation on licensing and undertaking custodian’s activities eng
29.01.2014 regulation on licensing and undertaking custodian’s activities eng
The Business Council of Mongolia
 
Vegetables for ED
Vegetables for EDVegetables for ED
Vegetables for ED
Derek Marshall
 
12.18.2013, REPORT, Selected Macroeconomic Indicators, International Monetar...
12.18.2013, REPORT, Selected Macroeconomic Indicators,  International Monetar...12.18.2013, REPORT, Selected Macroeconomic Indicators,  International Monetar...
12.18.2013, REPORT, Selected Macroeconomic Indicators, International Monetar...
The Business Council of Mongolia
 
2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum
2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum
2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum
The Business Council of Mongolia
 
2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...
2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...
2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...
The Business Council of Mongolia
 
18.04.2014, NEWSWIRE, Issue 321
18.04.2014, NEWSWIRE, Issue 32118.04.2014, NEWSWIRE, Issue 321
18.04.2014, NEWSWIRE, Issue 321
The Business Council of Mongolia
 
Goolians GeneSys
Goolians GeneSysGoolians GeneSys
Goolians GeneSys
filhosdagehenna
 
Marketing na fotografia
Marketing na fotografiaMarketing na fotografia
Marketing na fotografia
Glaucio Lacerda
 
Marc
MarcMarc
Paul
PaulPaul

Viewers also liked (16)

Humerus Başı çıkığı
Humerus Başı çıkığıHumerus Başı çıkığı
Humerus Başı çıkığı
 
Story telling. Tom Sawyer
Story telling. Tom Sawyer Story telling. Tom Sawyer
Story telling. Tom Sawyer
 
19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...
19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...
19.11.2014 Project overview: Khot Infrastructure Holdings Ltd, Purevbaatar Ba...
 
Multi-Team Development w Ember, Angular, Knockout etc @ Interactive Intelligence
Multi-Team Development w Ember, Angular, Knockout etc @ Interactive IntelligenceMulti-Team Development w Ember, Angular, Knockout etc @ Interactive Intelligence
Multi-Team Development w Ember, Angular, Knockout etc @ Interactive Intelligence
 
ЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗ
ЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ  КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ  КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗ
ЭГЕМЕНДҮҮЛҮК МЕЗГИЛДЕГИ КЫРГЫЗСТАН-ТҮРКИЯ ОРТОСУНДАГЫ МАМИЛЕЛЕРГЕ САЯСЫЙ АНАЛИЗ
 
Apresentação Ganhe Rapido
Apresentação Ganhe RapidoApresentação Ganhe Rapido
Apresentação Ganhe Rapido
 
29.01.2014 regulation on licensing and undertaking custodian’s activities eng
29.01.2014 regulation on licensing and undertaking custodian’s activities eng29.01.2014 regulation on licensing and undertaking custodian’s activities eng
29.01.2014 regulation on licensing and undertaking custodian’s activities eng
 
Vegetables for ED
Vegetables for EDVegetables for ED
Vegetables for ED
 
12.18.2013, REPORT, Selected Macroeconomic Indicators, International Monetar...
12.18.2013, REPORT, Selected Macroeconomic Indicators,  International Monetar...12.18.2013, REPORT, Selected Macroeconomic Indicators,  International Monetar...
12.18.2013, REPORT, Selected Macroeconomic Indicators, International Monetar...
 
2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum
2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum
2012. REPORT, Risk report for Mongolia 2012, Mongolia Economic Forum
 
2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...
2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...
2011, REPORT, Transition Report 2011 (full report), EBRD and the Economic Res...
 
18.04.2014, NEWSWIRE, Issue 321
18.04.2014, NEWSWIRE, Issue 32118.04.2014, NEWSWIRE, Issue 321
18.04.2014, NEWSWIRE, Issue 321
 
Goolians GeneSys
Goolians GeneSysGoolians GeneSys
Goolians GeneSys
 
Marketing na fotografia
Marketing na fotografiaMarketing na fotografia
Marketing na fotografia
 
Marc
MarcMarc
Marc
 
Paul
PaulPaul
Paul
 

Similar to Data weave documentation

Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
D.Rajesh Kumar
 
Data weave (MuleSoft)
Data weave (MuleSoft)Data weave (MuleSoft)
Data weave (MuleSoft)
Nandu List5
 
Mule data weave_2
Mule data weave_2Mule data weave_2
Mule data weave_2
kunal vishe
 
Data weave
Data weave Data weave
Data weave
Khasim Saheb
 
Data weave
Data weave Data weave
Data weave
Anand kalla
 
Data weave
Data weave Data weave
Data weave
Sunil Komarapu
 
Data weave
Data weave Data weave
Data weave
Khan625
 
Mule dataweave
Mule dataweaveMule dataweave
Mule data weave
Mule data weaveMule data weave
Mule data weave
D.Rajesh Kumar
 
Mule expression
Mule expressionMule expression
Mule expression
Ravinder Singh
 
MuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation languageMuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation language
fganora
 
Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
harika thamishetti
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
Son Nguyen
 
Web programming
Web programmingWeb programming
Web programming
Leo Mark Villar
 
Dataweave 160103180124
Dataweave 160103180124Dataweave 160103180124
Dataweave 160103180124
vijay dhanakodi
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
StrawhatLuffy11
 
Data weave
Data weaveData weave
Data weave
manavp
 
Data weave
Data weave Data weave
Data weave
princeirfancivil
 

Similar to Data weave documentation (20)

Data weave reference documentation
Data weave reference documentationData weave reference documentation
Data weave reference documentation
 
Data weave (MuleSoft)
Data weave (MuleSoft)Data weave (MuleSoft)
Data weave (MuleSoft)
 
Mule data weave_2
Mule data weave_2Mule data weave_2
Mule data weave_2
 
SCDJWS 5. JAX-WS
SCDJWS 5. JAX-WSSCDJWS 5. JAX-WS
SCDJWS 5. JAX-WS
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
 
Introduction to Visual Basic
Introduction to Visual Basic Introduction to Visual Basic
Introduction to Visual Basic
 
Mule data weave
Mule data weaveMule data weave
Mule data weave
 
Mule expression
Mule expressionMule expression
Mule expression
 
MuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation languageMuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation language
 
Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200Muledataweave10 161029032456-161119152200
Muledataweave10 161029032456-161119152200
 
Mule dataweave
Mule dataweaveMule dataweave
Mule dataweave
 
Web programming
Web programmingWeb programming
Web programming
 
Dataweave 160103180124
Dataweave 160103180124Dataweave 160103180124
Dataweave 160103180124
 
Easy Dataweave transformations - Ashutosh
Easy Dataweave transformations - AshutoshEasy Dataweave transformations - Ashutosh
Easy Dataweave transformations - Ashutosh
 
Data weave
Data weaveData weave
Data weave
 
Data weave
Data weave Data weave
Data weave
 

More from Khadhar Koneti

Glip team integration with ring central
Glip team integration with ring centralGlip team integration with ring central
Glip team integration with ring central
Khadhar Koneti
 
Sms integration with ring central
Sms integration with ring centralSms integration with ring central
Sms integration with ring central
Khadhar Koneti
 
Call ringout app
Call ringout appCall ringout app
Call ringout app
Khadhar Koneti
 
Ring central messaging api
Ring central messaging apiRing central messaging api
Ring central messaging api
Khadhar Koneti
 
Ring central voice api
Ring central voice apiRing central voice api
Ring central voice api
Khadhar Koneti
 
Ring central sdk overview
Ring central sdk overviewRing central sdk overview
Ring central sdk overview
Khadhar Koneti
 
Mule core concepts
Mule core conceptsMule core concepts
Mule core concepts
Khadhar Koneti
 
How muleworks
How muleworksHow muleworks
How muleworks
Khadhar Koneti
 

More from Khadhar Koneti (8)

Glip team integration with ring central
Glip team integration with ring centralGlip team integration with ring central
Glip team integration with ring central
 
Sms integration with ring central
Sms integration with ring centralSms integration with ring central
Sms integration with ring central
 
Call ringout app
Call ringout appCall ringout app
Call ringout app
 
Ring central messaging api
Ring central messaging apiRing central messaging api
Ring central messaging api
 
Ring central voice api
Ring central voice apiRing central voice api
Ring central voice api
 
Ring central sdk overview
Ring central sdk overviewRing central sdk overview
Ring central sdk overview
 
Mule core concepts
Mule core conceptsMule core concepts
Mule core concepts
 
How muleworks
How muleworksHow muleworks
How muleworks
 

Recently uploaded

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Data weave documentation

  • 1.
  • 2.  The Data Weave 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).
  • 3.  The Header, which defines directives (optional)  The Body, which describes the output structure  The two sections are delimited by a separator, which is not required if no header is present. The separator consists of three dashes: "---"
  • 4.  This code describes a conversion from a JSON input to an XML output: %dw 1.0 %input application/json %output application/xml --- { user: { name: payload.user_name, lastName: payload.user_lastName } }
  • 5.  If Output is other than Json , then just replace Json to required form like XML, CSV etc. in the header part : %input application/json • Payload attribute is the input data and each field should be separated by comma : name: payload.user_name, lastName: payload.user_lastName
  • 6. <?xml version="1.0" encoding="UTF-8"?> <user> <name> userNameFromPayload </name> <lastName> lastNameFromPayload</lastName> </user>
  • 7.  The sample output for the example shown above looks like : (Json format) { "user_name": “userNameFromPayload", "user_lastName": " lastNameFromPayload“ }
  • 8.  The DataWeave header contains the directives, which define high level information about your transformation. The structure of the Header is a sequence of lines, each with its own Directives. The Header is terminated with '---'.  All directives are declared on the header section of your DataWeave document and act upon the entire scope of it.  Directives are a mechanism to declare variables and constants and namespace aliases which need to be referenced in the Document. They are also needed to declare the type of the output of your transform.
  • 9.  DataWeave version  Input types and sources  Output type  Namespaces to import into your transform  Constants that can be referenced throughout the body  Functions that can be called throughout the body
  • 10. Version Directive : Namespace Directive :  Through this directive, you specify the version of the DataWeave syntax that is used to interpret the transformation.  coded as : %dw 1.0  This directive associates an alias with its subsequent URI. The directive is relevant only when either the input or the output is of type XML.  Coded as : %namespace mes http://www.mulesoft.co m/anypoint/SOA/messag e/v1.0
  • 11. Input Directive : Valid input types are :  Inputs are declared by assigning a name and a content type. You can then refer to them in any part of the DataWeave body through the names defined in the directive.  Coded as : %input payload application/xml  application/json  application/xml  application/java  application/csv  application/dw  text/json  text/xml  text/csv
  • 12.  When defining an input of type CSV, there are a few optional parameters you can add to the input directive to customize how the data is parsed. These are not defined in the DataWeave script but on the Mule XML code, in the Transform Message XML element.  There are two ways to achieve this :  Manually add the attributes to the project’s XML  graphical interface, by selecting the element from the tree view in the input section and clicking the gear icon
  • 13. Output Directive : Valid output types are :  The Output Directive specifies what the output type is in a transformation, which is specified using content/type. Only one output can be specified, the structure of this output is then defined in the DataWeave body.  Coded as : %output application/xml  application/json  application/xml  application/java  application/csv  application/dw  text/json  text/xml  text/csv
  • 14.  Whenever the output is of XML or JSON type and has null values in its elements or attributes, you can specify whether this generates an outbound message that contains fields with "null" values, or if these fields are ignored entirely. This can be set through an attribute in the output directive named skipNullOn, which can be set to three different values: elements, attributes, or everywhere.  Like : %output application/xml skipNullOn="everywhere“ When set to:  elements: A key:value pair with a null value is ignored.  attributes: An XML attribute with a null value is skipped.  everywhere: Apply this rule to both elements and attributes.
  • 15.  DataWeave uses three basic data types: Objects, Arrays, and Simple Types, the execution of a DataWeave transformation always produces one of these three types of data.  This expression can be built using any of the following elements:  Objects  Arrays  Simple literals  Variable and Constant references
  • 16.  Input <?xml version="1.0" encoding="UTF-8"?> <note> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note>
  • 17. %dw 1.0 %output application/dw --- payload Output : { note: { to: "Tove", from: "Jani", heading: "Reminder", body: "Dont forget me this weekend!“ } }
  • 18. Still many to learn … Stay tuned!!!!!!!!!!!!