2. Enterprise Integration Patterns

json2Xml

Converts JSON message bodies into XML. The converter wraps the JSON document into a root element. The name of the root element is configurable. If unset, JSON objects default to "root" and JSON arrays default to "array". This interceptor reads the JSON body, converts it into XML and updates the message body and Content-Type header. The resulting XML is always UTF-8 encoded and starts with an XML prolog.

Can be used in:

serviceProxy, api, global, chainDef, for, stompProxy, time, if, registration, wsStompReassembler, internal, interceptor, chain, bean, transport and soapProxy

Syntax

<api port="2000">
  <request>
    <json2Xml/>
  </request>
  <target url="http://localhost:3000"/>
</api>

Attributes

NameRequiredDefaultDescriptionExamples
item false - - -
array false "array"
- -
root false "root" for objects and "array" for arrays
- -