Version: 17.07
Supported Since: 17.01
A JSON to XML Transformer is a processing element which transforms a JSON message payload to an XML payload. This transformation is done based on a generic set of rules and hence this processing element is most suitable for simple transformations. For complex transformations based on custom rules, Adroitlogic Data Mapping Tool is recommended.
In order to use this processing element, you must first select the JSON Operations dependency from the processors list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the JSON Operations dependency. |
Next |
The message will be sent to this outport if the payload transformation is completed successfully |
On Exception |
The message will be sent to this outport if the processing element failed to transform the payload due to some reason |
Root Element Name |
Basic |
This parameter will be used as the name of the root element of XML output. This is an optional parameter and the default value is "root-element" |
Array Element Name |
Basic |
If the JSON input has an array as the first level element, the value of this parameter will be used as the name of the xml tag that encloses each array element. This is an optional parameter and the default value is "element" |
Use Namespace Prefix |
Basic |
An option to be selected if namespace prefix needs to be set for the XML tags of the output |
Namespace Prefix |
Basic |
Namespace prefix to be used for the XML output if Use Namespace Prefix is enabled |
Namespace URI |
Basic |
Namespace URI to be used for the XML output if Use Namespace Prefix is enabled |
In the following use case, the requirement is to read a message with a JSON payload from a SFTP server, convert the message payload to XML and then deliver it to another SFTP endpoint.
In this flow, the Processor
outport of
SFTP ingress connector
is connected to the inport of the JSON to XML Transformer so that the SFTP message received by the connector
is handed over to the transformer next. If the processing element is able to transform the payload from JSON to XML
successfully, the message with the transformed payload is handed over to the
SFTP egress connector,
since the "Next" outport of the JSON to XML Transformer is connected to it.
In the case of transformation failure, a log will be generated and then the message flow will be completed in an exceptional state, as the "On Exception" outport of the JSON to XML Transformer is connected to a Logger processing element, followed by an Exceptional Flow End element.