SlideShare a Scribd company logo
1 of 5
Mule ESB
How to use Jackson in Object to Json converter
Raffaela Vitiello - 2016
In this tutorial we will be creating an easy object to json converter using Jackson annotations
in order to have major control on the fields datamapping.
As usual, let’s begin creating the http inbound component to trigger the flow
We want to transform this Object to Json:
package com.mulechampion;
import java.io.Serializable;
import org.codehaus.jackson.annotate.JsonProperty;
public class JsonClass implements Serializable{
/**
*
*/
private static final long serialVersionUID = -5645625751838751914L;
@JsonProperty(value="name")
private String fullName;
@JsonProperty(value="surname")
private String fullSurname;
@JsonProperty(value="profession")
private String job;
public JsonClass(String fullName, String fullSurname, String job) {
super();
this.fullName = fullName;
this.fullSurname = fullSurname;
this.job = job;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getFullSurname() {
return fullSurname;
}
public void setFullSurname(String fullSurname) {
this.fullSurname = fullSurname;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
@Override
public String toString() {
return "JsonClass [fullName=" + fullName + ", fullSurname="
+ fullSurname + ", job=" + job + "]";
}
}
The problem here is that there’s no automatic field mapping based on the fields name,
resulting in the following error, if we start the application with this flow:
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "name"
(Class com.mulechampion.JsonClass), not marked as ignorable
To solve this, we will use Jackson annotations in this way:
@JsonProperty(value="name")
private String fullName;
@JsonProperty(value="surname")
private String fullSurname;
@JsonProperty(value="profession")
private String job;
If we start now the application we will finally obtain the following output on the console:
HTTP_Listener_Configuration.worker.01]
org.mule.api.processor.LoggerMessageProcessor:
{"name":"Gennaro","surname":"Spagnoli","profession":"programmer"}

More Related Content

What's hot

Xslt in mule
Xslt in muleXslt in mule
Xslt in muleirfan1008
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformerirfan1008
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mulePraneethchampion
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in muleKhan625
 
Creating dynamic json in Mule
Creating dynamic json in MuleCreating dynamic json in Mule
Creating dynamic json in MuleF K
 

What's hot (12)

Xslt in mule
Xslt in muleXslt in mule
Xslt in mule
 
Mule esb json_to_object
Mule esb json_to_objectMule esb json_to_object
Mule esb json_to_object
 
Muleesbobjecttojson
Muleesbobjecttojson Muleesbobjecttojson
Muleesbobjecttojson
 
Mule esb object_to_json
Mule esb object_to_jsonMule esb object_to_json
Mule esb object_to_json
 
Converting with custom transformer
Converting with custom transformerConverting with custom transformer
Converting with custom transformer
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
 
Splitting with mule part2
Splitting with mule part2Splitting with mule part2
Splitting with mule part2
 
Creating dynamic json in Mule
Creating dynamic json in MuleCreating dynamic json in Mule
Creating dynamic json in Mule
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Idempotent filter with simple file
Idempotent filter with simple fileIdempotent filter with simple file
Idempotent filter with simple file
 
Mule parsing with json part2
Mule parsing with json part2Mule parsing with json part2
Mule parsing with json part2
 

Viewers also liked

SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule EsbAnand kalla
 
Database component in mule
Database component in muleDatabase component in mule
Database component in mulejaveed_mhd
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collectionAnand kalla
 
File types pro forma(1)
File types pro forma(1)File types pro forma(1)
File types pro forma(1)joe cole
 
Mule esb made system integration easy
Mule esb made system integration easy Mule esb made system integration easy
Mule esb made system integration easy javeed_mhd
 
TEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇA
TEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇATEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇA
TEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇAMedia Education
 
ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!
ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!
ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!Media Education
 
[TCC] Design Thinking aplicado ao Branding
[TCC] Design Thinking aplicado ao Branding[TCC] Design Thinking aplicado ao Branding
[TCC] Design Thinking aplicado ao BrandingPaola Bellucci Ortolan
 
Ericsson Rbs 6201 commisioning (1)
Ericsson Rbs 6201 commisioning (1)Ericsson Rbs 6201 commisioning (1)
Ericsson Rbs 6201 commisioning (1)Behnam Dorudian
 
Lebenslauf Ingenieur Jijiie,Daniel
Lebenslauf Ingenieur Jijiie,DanielLebenslauf Ingenieur Jijiie,Daniel
Lebenslauf Ingenieur Jijiie,DanielDaniel Jijie
 
What is Comms Planning?
What is Comms Planning?What is Comms Planning?
What is Comms Planning?Julian Cole
 

Viewers also liked (16)

SOAP Service in Mule Esb
SOAP Service in Mule EsbSOAP Service in Mule Esb
SOAP Service in Mule Esb
 
Database component in mule
Database component in muleDatabase component in mule
Database component in mule
 
Genre research country
Genre research   countryGenre research   country
Genre research country
 
Mule for each scope header collection
Mule for each scope header collectionMule for each scope header collection
Mule for each scope header collection
 
Ps week 12
Ps week 12Ps week 12
Ps week 12
 
File types pro forma(1)
File types pro forma(1)File types pro forma(1)
File types pro forma(1)
 
Mule esb made system integration easy
Mule esb made system integration easy Mule esb made system integration easy
Mule esb made system integration easy
 
Resin Infiltration Technique
Resin Infiltration TechniqueResin Infiltration Technique
Resin Infiltration Technique
 
TEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇA
TEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇATEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇA
TEMPLATE RESPONSIVO - CUIDADOS E APLICAÇÕES SIMPLES QUE FAZEM A DIFERENÇA
 
ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!
ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!
ACERTE NA ABERTURA: DICAS PARA CRIAR ASSUNTOS INFALÍVEIS!
 
[TCC] Design Thinking aplicado ao Branding
[TCC] Design Thinking aplicado ao Branding[TCC] Design Thinking aplicado ao Branding
[TCC] Design Thinking aplicado ao Branding
 
Mídia-educação
Mídia-educaçãoMídia-educação
Mídia-educação
 
Pontics in fpd
Pontics in fpdPontics in fpd
Pontics in fpd
 
Ericsson Rbs 6201 commisioning (1)
Ericsson Rbs 6201 commisioning (1)Ericsson Rbs 6201 commisioning (1)
Ericsson Rbs 6201 commisioning (1)
 
Lebenslauf Ingenieur Jijiie,Daniel
Lebenslauf Ingenieur Jijiie,DanielLebenslauf Ingenieur Jijiie,Daniel
Lebenslauf Ingenieur Jijiie,Daniel
 
What is Comms Planning?
What is Comms Planning?What is Comms Planning?
What is Comms Planning?
 

Similar to Mule ESB Object to Json Converter Using Jackson Annotations

Mule esb object_to_jackson_json
Mule esb object_to_jackson_jsonMule esb object_to_jackson_json
Mule esb object_to_jackson_jsonDavide Rapacciuolo
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future TaskSomenath Mukhopadhyay
 
Retrofit Technology Overview by Cumulations Technologies
Retrofit Technology Overview by Cumulations TechnologiesRetrofit Technology Overview by Cumulations Technologies
Retrofit Technology Overview by Cumulations TechnologiesCumulations Technologies
 
WuKong - Framework for Integrated Test
WuKong - Framework for Integrated TestWuKong - Framework for Integrated Test
WuKong - Framework for Integrated TestSummer Lu
 
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfCreating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfShaiAlmog1
 
Converting with custom transformer part 2
Converting with custom transformer part 2Converting with custom transformer part 2
Converting with custom transformer part 2Anirban Sen Chowdhary
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfShaiAlmog1
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of JavascriptTarek Yehia
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo Ali Parmaksiz
 
Link.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docxLink.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docxSHIVA101531
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentationipolevoy
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with KotlinBrandon Wever
 
JSON & AJAX.pptx
JSON & AJAX.pptxJSON & AJAX.pptx
JSON & AJAX.pptxdyumna2
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oopLearningTech
 

Similar to Mule ESB Object to Json Converter Using Jackson Annotations (20)

Mule esb object_to_jackson_json
Mule esb object_to_jackson_jsonMule esb object_to_jackson_json
Mule esb object_to_jackson_json
 
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergrationSpring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
 
Java concurrency model - The Future Task
Java concurrency model - The Future TaskJava concurrency model - The Future Task
Java concurrency model - The Future Task
 
Retrofit Technology Overview by Cumulations Technologies
Retrofit Technology Overview by Cumulations TechnologiesRetrofit Technology Overview by Cumulations Technologies
Retrofit Technology Overview by Cumulations Technologies
 
WuKong - Framework for Integrated Test
WuKong - Framework for Integrated TestWuKong - Framework for Integrated Test
WuKong - Framework for Integrated Test
 
Creating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdfCreating a Whatsapp Clone - Part II - Transcript.pdf
Creating a Whatsapp Clone - Part II - Transcript.pdf
 
Converting with custom transformer part 2
Converting with custom transformer part 2Converting with custom transformer part 2
Converting with custom transformer part 2
 
Spring
SpringSpring
Spring
 
create-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdfcreate-netflix-clone-02-server.pdf
create-netflix-clone-02-server.pdf
 
Xml & Java
Xml & JavaXml & Java
Xml & Java
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
Art of Javascript
Art of JavascriptArt of Javascript
Art of Javascript
 
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo A GWT Application with MVP Pattern Deploying to CloudFoundry using  Spring Roo
A GWT Application with MVP Pattern Deploying to CloudFoundry using Spring Roo
 
Link.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docxLink.javaLink.javapackage com.bookstore.domain.model;import .docx
Link.javaLink.javapackage com.bookstore.domain.model;import .docx
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
From Swing to JavaFX
From Swing to JavaFXFrom Swing to JavaFX
From Swing to JavaFX
 
Be More Productive with Kotlin
Be More Productive with KotlinBe More Productive with Kotlin
Be More Productive with Kotlin
 
JSON & AJAX.pptx
JSON & AJAX.pptxJSON & AJAX.pptx
JSON & AJAX.pptx
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 

Recently uploaded

定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一3sw2qly1
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...akbard9823
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Roomdivyansh0kumar0
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Roomishabajaj13
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 

Recently uploaded (20)

Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
定制(CC毕业证书)美国美国社区大学毕业证成绩单原版一比一
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance VVIP 🍎 SERVICE
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SERVICECall Girls Service Dwarka @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SERVICE
Call Girls Service Dwarka @9999965857 Delhi 🫦 No Advance VVIP 🍎 SERVICE
 
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
Sushant Golf City / best call girls in Lucknow | Service-oriented sexy call g...
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-
sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-
sasti delhi Call Girls in munirka 🔝 9953056974 🔝 escort Service-
 
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With RoomVIP Kolkata Call Girl Dum Dum 👉 8250192130  Available With Room
VIP Kolkata Call Girl Dum Dum 👉 8250192130 Available With Room
 
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With RoomVIP Kolkata Call Girl Salt Lake 👉 8250192130  Available With Room
VIP Kolkata Call Girl Salt Lake 👉 8250192130 Available With Room
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 

Mule ESB Object to Json Converter Using Jackson Annotations

  • 1. Mule ESB How to use Jackson in Object to Json converter Raffaela Vitiello - 2016
  • 2. In this tutorial we will be creating an easy object to json converter using Jackson annotations in order to have major control on the fields datamapping. As usual, let’s begin creating the http inbound component to trigger the flow
  • 3. We want to transform this Object to Json: package com.mulechampion; import java.io.Serializable; import org.codehaus.jackson.annotate.JsonProperty; public class JsonClass implements Serializable{ /** * */ private static final long serialVersionUID = -5645625751838751914L; @JsonProperty(value="name") private String fullName; @JsonProperty(value="surname") private String fullSurname; @JsonProperty(value="profession") private String job; public JsonClass(String fullName, String fullSurname, String job) { super(); this.fullName = fullName; this.fullSurname = fullSurname; this.job = job; } public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public String getFullSurname() { return fullSurname; } public void setFullSurname(String fullSurname) { this.fullSurname = fullSurname; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } @Override public String toString() { return "JsonClass [fullName=" + fullName + ", fullSurname=" + fullSurname + ", job=" + job + "]"; } }
  • 4. The problem here is that there’s no automatic field mapping based on the fields name, resulting in the following error, if we start the application with this flow: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "name" (Class com.mulechampion.JsonClass), not marked as ignorable To solve this, we will use Jackson annotations in this way: @JsonProperty(value="name") private String fullName; @JsonProperty(value="surname") private String fullSurname; @JsonProperty(value="profession") private String job;
  • 5. If we start now the application we will finally obtain the following output on the console: HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: {"name":"Gennaro","surname":"Spagnoli","profession":"programmer"}