2. Enterprise Integration Patterns

json2Xml

Version
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

Syntax

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

Attributes

NameRequiredDefaultDescriptionExamples
arrayfalse"array"--
itemfalse---
rootfalse"root" for objects and "array" for arrays--