Mule JSON Transformers
JSON Primer
• JavaScript Object Notation
- a lightweight datainterchange format
[ element1, element2, element3..... ]
• Human-Readable Syntax
• Supports
1. Collections
2. Maps
{
"name1":"value",
"name2":"value"
}
JSON Primer
• Supports the combining:
1. Collections
∙ employees[0]
∙ employees[1]
2. Maps
• Supporting more complex data
JSON Transformer
• Object to JSON
- receives an object and returns JSON syntax
- uses reflection (no configuration necessary)
• JSON to Object
- populates a Java object from a JSON structure
- requires at least the name of the class
JSON Example
1. JSON input enters with an order request
2. Order business logic exists in a java component
3. After processing, a response comes back with the tax
included
JSON Example
1. Java object representation of an order
2. Can be read by business logic
3. Fields match that of JSON request.
JSON Example
JSON Example
1. JSON is transformed to Order
- returnClass specified
2. Order transformed back to JSON
JSON Example
• XML to JAXB
- Uses the JAXB binding framework to serialize to xml
or in reverse to an object
- Counterpart exists at JAXB to XML
• XML to Object
- Utilizes Xstream to convert data to and from XML
and Java Objects
- Counterpart exists as Object to XML

Mule json transformers

  • 1.
  • 2.
    JSON Primer • JavaScriptObject Notation - a lightweight datainterchange format [ element1, element2, element3..... ] • Human-Readable Syntax • Supports 1. Collections 2. Maps { "name1":"value", "name2":"value" }
  • 3.
    JSON Primer • Supportsthe combining: 1. Collections ∙ employees[0] ∙ employees[1] 2. Maps • Supporting more complex data
  • 4.
    JSON Transformer • Objectto JSON - receives an object and returns JSON syntax - uses reflection (no configuration necessary) • JSON to Object - populates a Java object from a JSON structure - requires at least the name of the class
  • 5.
    JSON Example 1. JSONinput enters with an order request 2. Order business logic exists in a java component 3. After processing, a response comes back with the tax included
  • 6.
    JSON Example 1. Javaobject representation of an order 2. Can be read by business logic 3. Fields match that of JSON request.
  • 7.
  • 8.
    JSON Example 1. JSONis transformed to Order - returnClass specified 2. Order transformed back to JSON
  • 9.
    JSON Example • XMLto JAXB - Uses the JAXB binding framework to serialize to xml or in reverse to an object - Counterpart exists at JAXB to XML • XML to Object - Utilizes Xstream to convert data to and from XML and Java Objects - Counterpart exists as Object to XML