SlideShare a Scribd company logo
MULE: JSON TO OBJECT
HANDLING UNRECOGNIZED FIELD
JSON SUPPORT REFERENCE
‱ JSON, short for JavaScript Object Notation, is a lightweight data
interchange format.
‱ Mule supports binding JSON data to objects and marshalling Java
object to JSON using the Jackson Framework.
‱ JSON transformers have been added in Studio to make it easy to
work with JSON encoded messages.
JSON BINDINGS (1/2)
‱ Jackson uses annotations to describe how data is mapped to a Java
object model.
‱ For example an JSON file that describes a person:
{
"id": 1,
"name": "Max"
}
JSON BINDINGS (2/2)
‱ @JsonAutoDetect maps directly the field member names to JSON
field names.
package com.mulesoft.learning;
import org.codehaus.jackson.annotate.JsonAutoDetect;
@JsonAutoDetect
public class Person {
private String id;
private String name;
//getter-setter
}
JSON TO OBJECT: DEMO - DESIGN
‱ HTTP: an inbound endpoint for posting the JSON data.
‱ JSON to Object: transforming the JSON data to a Java object.
‱ Logger: displaying the log.
JSON TO OBJECT: DEMO - XML CONFIG
‱ Two-way editing between graphical and XML views.
<flow name="jsonToObjectFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/"
doc:name="HTTP"/>
<json:json-to-object-transformer
returnClass="com.mulesoft.learning.Person" doc:name="JSON to Object"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
JSON TO OBJECT: TESTING (1/2)
‱ Use a REST Client, e.g.: Postman, for posting the JSON data.
JSON TO OBJECT: TESTING (2/2)
‱ Posting the JSON data with an unrecognized field: Failed!
JSON TO OBJECT: ISSUE
‱ JSON to Object Transformer failed to transform an JSON data with
unrecognized field.
‱ Root Exception stack trace:
org.codehaus.jackson.map.exc.UnrecognizedPropertyException:
Unrecognized field "type" (Class com.mulesoft.learning.Person),
not marked as ignorable.
‱ How to easily adapt to change if this issue happens?
JSON TO OBJECT: SOLUTION
‱ Ignore unrecognized field.
package com.mulesoft.learning;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@JsonAutoDetect
@JsonIgnoreProperties(ignoreUnknown=true)
public class Person {
private String id;
private String name;
//getter-setter
}
JSON TO OBJECT: FINAL TESTING
‱ Posting the JSON data with an unrecognized field: Success!
SUMMARY
‱ JSON is natively supported in Mule.
‱ JSON data can be bind automatically to Java object.
‱ Unrecognized field can be handled by Jackson Framework.
RESOURCES
‱ https://docs.mulesoft.com/mule-user-guide/v/3.8/json-module-
reference
‱ https://docs.mulesoft.com/mule-user-guide/v/3.8/native-support-
for-json

More Related Content

What's hot (19)

PPTX
Mule json transformers
veena naresh
 
PPTX
AJAX
Jussi Pohjolainen
 
PDF
Ruby de Rails
Yuichiro MASUI
 
PPTX
Introduction to JSON & AJAX
Collaboration Technologies
 
PPT
java script json
chauhankapil
 
PPTX
Mule requesterdemo
Anirban Sen Chowdhary
 
PPTX
Mapping and listing with mule
Praneethchampion
 
PPTX
Mapping and listing in mule
Khan625
 
PPTX
Json to json esb transformation
Domenico Schiavone
 
PPTX
Node js crash course session 3
Abdul Rahman Masri Attal
 
PPTX
Transformation jsontojsonesb
Antonio Pellegrino
 
PPTX
Node js crash course session 5
Abdul Rahman Masri Attal
 
PPTX
Json to json transformation in mule
Davide Rapacciuolo
 
PPTX
Sql Server 2016 and JSON
Greg McMurray
 
PPTX
Transformation jsontojsonesb
Davide Rapacciuolo
 
PPTX
Javascript in C# for Lightweight Applications
VelanSalis
 
PPTX
Node js crash course session 6
Abdul Rahman Masri Attal
 
PPTX
Using Webservice in iOS
Mahboob Nur
 
PDF
Getting started with MongoDB and Scala - Open Source Bridge 2012
sullis
 
Mule json transformers
veena naresh
 
Ruby de Rails
Yuichiro MASUI
 
Introduction to JSON & AJAX
Collaboration Technologies
 
java script json
chauhankapil
 
Mule requesterdemo
Anirban Sen Chowdhary
 
Mapping and listing with mule
Praneethchampion
 
Mapping and listing in mule
Khan625
 
Json to json esb transformation
Domenico Schiavone
 
Node js crash course session 3
Abdul Rahman Masri Attal
 
Transformation jsontojsonesb
Antonio Pellegrino
 
Node js crash course session 5
Abdul Rahman Masri Attal
 
Json to json transformation in mule
Davide Rapacciuolo
 
Sql Server 2016 and JSON
Greg McMurray
 
Transformation jsontojsonesb
Davide Rapacciuolo
 
Javascript in C# for Lightweight Applications
VelanSalis
 
Node js crash course session 6
Abdul Rahman Masri Attal
 
Using Webservice in iOS
Mahboob Nur
 
Getting started with MongoDB and Scala - Open Source Bridge 2012
sullis
 

Similar to Mule: JSON to Object (9)

PPTX
Java-JSON-Jackson
Srilatha Kante
 
PPTX
Mule json transformers and Examples
Naresh Naidu
 
PPTX
Transform json to json
Son Nguyen
 
PPTX
Simple Jackson with DropWizard
Tatu Saloranta
 
PPTX
Mule esb json_to_object
Davide Rapacciuolo
 
PPTX
Transformation jsontojsonesb
Germano Barba
 
PPTX
Mule esb - How to convert from Json to Object in 5 minutes
Gennaro Spagnoli
 
PDF
Java EE 8 Recipes
Josh Juneau
 
PPTX
Muleesbobjecttojson
Davide Rapacciuolo
 
Java-JSON-Jackson
Srilatha Kante
 
Mule json transformers and Examples
Naresh Naidu
 
Transform json to json
Son Nguyen
 
Simple Jackson with DropWizard
Tatu Saloranta
 
Mule esb json_to_object
Davide Rapacciuolo
 
Transformation jsontojsonesb
Germano Barba
 
Mule esb - How to convert from Json to Object in 5 minutes
Gennaro Spagnoli
 
Java EE 8 Recipes
Josh Juneau
 
Muleesbobjecttojson
Davide Rapacciuolo
 
Ad

Recently uploaded (20)

PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih KĂŒĂ§ĂŒk
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih KĂŒĂ§ĂŒk
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Foundations of Marketo Engage - Powering Campaigns with Marketo Personalization
bbedford2
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Ad

Mule: JSON to Object

  • 1. MULE: JSON TO OBJECT HANDLING UNRECOGNIZED FIELD
  • 2. JSON SUPPORT REFERENCE ‱ JSON, short for JavaScript Object Notation, is a lightweight data interchange format. ‱ Mule supports binding JSON data to objects and marshalling Java object to JSON using the Jackson Framework. ‱ JSON transformers have been added in Studio to make it easy to work with JSON encoded messages.
  • 3. JSON BINDINGS (1/2) ‱ Jackson uses annotations to describe how data is mapped to a Java object model. ‱ For example an JSON file that describes a person: { "id": 1, "name": "Max" }
  • 4. JSON BINDINGS (2/2) ‱ @JsonAutoDetect maps directly the field member names to JSON field names. package com.mulesoft.learning; import org.codehaus.jackson.annotate.JsonAutoDetect; @JsonAutoDetect public class Person { private String id; private String name; //getter-setter }
  • 5. JSON TO OBJECT: DEMO - DESIGN ‱ HTTP: an inbound endpoint for posting the JSON data. ‱ JSON to Object: transforming the JSON data to a Java object. ‱ Logger: displaying the log.
  • 6. JSON TO OBJECT: DEMO - XML CONFIG ‱ Two-way editing between graphical and XML views. <flow name="jsonToObjectFlow"> <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/> <json:json-to-object-transformer returnClass="com.mulesoft.learning.Person" doc:name="JSON to Object"/> <logger message="#[payload]" level="INFO" doc:name="Logger"/> </flow>
  • 7. JSON TO OBJECT: TESTING (1/2) ‱ Use a REST Client, e.g.: Postman, for posting the JSON data.
  • 8. JSON TO OBJECT: TESTING (2/2) ‱ Posting the JSON data with an unrecognized field: Failed!
  • 9. JSON TO OBJECT: ISSUE ‱ JSON to Object Transformer failed to transform an JSON data with unrecognized field. ‱ Root Exception stack trace: org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "type" (Class com.mulesoft.learning.Person), not marked as ignorable. ‱ How to easily adapt to change if this issue happens?
  • 10. JSON TO OBJECT: SOLUTION ‱ Ignore unrecognized field. package com.mulesoft.learning; import org.codehaus.jackson.annotate.JsonAutoDetect; import org.codehaus.jackson.annotate.JsonIgnoreProperties; @JsonAutoDetect @JsonIgnoreProperties(ignoreUnknown=true) public class Person { private String id; private String name; //getter-setter }
  • 11. JSON TO OBJECT: FINAL TESTING ‱ Posting the JSON data with an unrecognized field: Success!
  • 12. SUMMARY ‱ JSON is natively supported in Mule. ‱ JSON data can be bind automatically to Java object. ‱ Unrecognized field can be handled by Jackson Framework.