SlideShare a Scribd company logo
Mule ESB
How to convert from Object to Json
In this tutorial we will be creating an easy object to json converter using mule esb.
Let’s begin creating a simple flow with an http listener, in order to trigger the
transformation:
Now, let’s create a java pojo class, called User, like this:
package com.mulechampion;
import java.io.Serializable;
public class JsonClass implements Serializable{
/**
*
*/
private static final long serialVersionUID = -5645625751838751914L;
private String name;
private String surname;
public JsonClass(String name, String surname) {
super();
this.name = name;
this.surname = surname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSurname() {
return surname;
}
public void setSurnme(String surnme) {
this.surname = surnme;
}
@Override
public String toString() {
return "JsonClass [name=" + name + ", surname=" + surname + "]";
}
}
Now we can use the setPayload component to populate the bean created before:
Value: #[new.com.mulechampion.JsonClass(‘Usern’,’Users)]
As expected, running this app, will produce the following log on console:
HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor: JsonClass [name=Usern,
surname=Users]
Now let’s add the Object-to-json transformer in order to obtain the output JSON
If we launch the application, calling it, we will obtain the json output, as wanted!
HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor:
{"name":“Usern","surname":“Users"}
Enjoy with the MULE!

More Related Content

PPTX
Mule esb object_to_json
PPTX
Mule esb json_to_object
PPTX
Mule esb - How to convert from Json to Object in 5 minutes
PPTX
Mule esb How to convert from Object to Json in 5 minutes
PPTX
Mule esb How to use Jackson in Json to Object converter
PPTX
Mule esb How to use Jackson in Object to Json converter
PPTX
Converting with custom transformer
 
PPTX
Converting with custom transformer
Mule esb object_to_json
Mule esb json_to_object
Mule esb - How to convert from Json to Object in 5 minutes
Mule esb How to convert from Object to Json in 5 minutes
Mule esb How to use Jackson in Json to Object converter
Mule esb How to use Jackson in Object to Json converter
Converting with custom transformer
 
Converting with custom transformer

What's hot (8)

PPTX
Mule parsing with json
PPTX
Transformation jsontoxmlesb
PPSX
Control structures
PPTX
Mule parsing with json part2
PPTX
Mapping and listing in mule
PDF
ReactiveMongo - non blocking and asynchronous I/O operations
PPT
New kid on the block node.js
PPTX
Mapping and listing with mule
Mule parsing with json
Transformation jsontoxmlesb
Control structures
Mule parsing with json part2
Mapping and listing in mule
ReactiveMongo - non blocking and asynchronous I/O operations
New kid on the block node.js
Mapping and listing with mule
Ad

Viewers also liked (18)

PPTX
Consuming raml
PPT
RAML - The architecture
PPT
PPTX
Ftp connector
ODP
Mule Complete Training
PPTX
SMTP MULE
PPTX
Basic auth implementation using raml in mule
PPTX
Purcell 2000000744
PPT
Self portraits
PPT
Infoflow 2 16 11
DOCX
Tcvb2 marco gomes_wireless
DOCX
хэрэглэгдэхүүн 5
PPTX
Virksomhetssøk for prosjekt - Comperio
XLS
Expense report
PPT
puppy ads
PDF
Section based hex cell routing algorithm (sbhcr)
PDF
White Paper: Perforce Administration Optimization, Scalability, Availability ...
PPTX
Sortida colliure estiu 2011
Consuming raml
RAML - The architecture
Ftp connector
Mule Complete Training
SMTP MULE
Basic auth implementation using raml in mule
Purcell 2000000744
Self portraits
Infoflow 2 16 11
Tcvb2 marco gomes_wireless
хэрэглэгдэхүүн 5
Virksomhetssøk for prosjekt - Comperio
Expense report
puppy ads
Section based hex cell routing algorithm (sbhcr)
White Paper: Perforce Administration Optimization, Scalability, Availability ...
Sortida colliure estiu 2011
Ad

Similar to Muleesbobjecttojson (20)

PPTX
Mule esb object_to_jackson_json
PDF
Manual tecnic sergi_subirats
PDF
create-netflix-clone-02-server.pdf
PDF
can do this in java please thanks in advance The code that y.pdf
DOCX
OOP Lab Report.docx
PPTX
Converting with custom transformer part 2
PDF
Spring hibernate jsf_primefaces_intergration
PPTX
Computer programming 2 -lesson 4
PPTX
Retrofit Technology Overview by Cumulations Technologies
PDF
define a class name Employee whose objects are records for employee..pdf
PDF
Introduction kot iin
PPT
Java
PDF
Creating a Whatsapp Clone - Part II - Transcript.pdf
ODP
1.1 motivation
PPSX
Java.lang.object
PPTX
TDC2016SP - Trilha .NET
PPTX
ECMAScript 2015
ODP
1.1 motivation
ODP
1.1 motivation
ODP
1.1 motivation
Mule esb object_to_jackson_json
Manual tecnic sergi_subirats
create-netflix-clone-02-server.pdf
can do this in java please thanks in advance The code that y.pdf
OOP Lab Report.docx
Converting with custom transformer part 2
Spring hibernate jsf_primefaces_intergration
Computer programming 2 -lesson 4
Retrofit Technology Overview by Cumulations Technologies
define a class name Employee whose objects are records for employee..pdf
Introduction kot iin
Java
Creating a Whatsapp Clone - Part II - Transcript.pdf
1.1 motivation
Java.lang.object
TDC2016SP - Trilha .NET
ECMAScript 2015
1.1 motivation
1.1 motivation
1.1 motivation

More from Davide Rapacciuolo (20)

PPTX
Mule esb db_2
PPTX
Mule esb db_1
PPTX
Transf from csv to xml
PPTX
Esb choice flow
PPTX
Xml to xml transformation in mule
PPTX
Transformation xmltoobjectesb
PPTX
Transformation jsontoxmlesb
PPTX
Transformation jsontojsonesb
PPTX
Transformation csvtoxml
PPTX
Rest fullservices
PPTX
Xml to xml transformation in mule
PPTX
Mule esb object_to_json
PPTX
Mule esb expression_filter
PPTX
Mule esb collection_splitter
PPTX
Mule esb soap_service
PPTX
Transformation xmltoobjectesb
PPTX
Mule esb csv_to_json
PPTX
Json to json transformation in mule
PPTX
Mule esb file to-string flow
PPTX
My mule esb first http flow
Mule esb db_2
Mule esb db_1
Transf from csv to xml
Esb choice flow
Xml to xml transformation in mule
Transformation xmltoobjectesb
Transformation jsontoxmlesb
Transformation jsontojsonesb
Transformation csvtoxml
Rest fullservices
Xml to xml transformation in mule
Mule esb object_to_json
Mule esb expression_filter
Mule esb collection_splitter
Mule esb soap_service
Transformation xmltoobjectesb
Mule esb csv_to_json
Json to json transformation in mule
Mule esb file to-string flow
My mule esb first http flow

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Cloud computing and distributed systems.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
cuic standard and advanced reporting.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Understanding_Digital_Forensics_Presentation.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
sap open course for s4hana steps from ECC to s4
Cloud computing and distributed systems.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
cuic standard and advanced reporting.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
20250228 LYD VKU AI Blended-Learning.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Network Security Unit 5.pdf for BCA BBA.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows

Muleesbobjecttojson

  • 1. Mule ESB How to convert from Object to Json
  • 2. In this tutorial we will be creating an easy object to json converter using mule esb. Let’s begin creating a simple flow with an http listener, in order to trigger the transformation: Now, let’s create a java pojo class, called User, like this:
  • 3. package com.mulechampion; import java.io.Serializable; public class JsonClass implements Serializable{ /** * */ private static final long serialVersionUID = -5645625751838751914L; private String name; private String surname; public JsonClass(String name, String surname) { super(); this.name = name; this.surname = surname; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurnme(String surnme) { this.surname = surnme; } @Override public String toString() { return "JsonClass [name=" + name + ", surname=" + surname + "]"; } }
  • 4. Now we can use the setPayload component to populate the bean created before: Value: #[new.com.mulechampion.JsonClass(‘Usern’,’Users)] As expected, running this app, will produce the following log on console: HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: JsonClass [name=Usern, surname=Users]
  • 5. Now let’s add the Object-to-json transformer in order to obtain the output JSON If we launch the application, calling it, we will obtain the json output, as wanted! HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"name":“Usern","surname":“Users"} Enjoy with the MULE!