JSON to XML Transformer
Discover more about the JSON to XML Transformer component and how to use it on the Digibee Integration Platform.
JSON to XML Transformer generates an XML based on a JSON received in its input message.
Parameters
Take a look at the configuration options for the component. Parameters supported by Double Braces expressions are marked with (DB)
.
Parameter | Description | Default value | Data type |
---|---|---|---|
JSON Field Path | JSON as path of the string field in dotted notation. | payload | String |
Root Element Name | Root element of the generated XML. | body | String |
Root Element Attribute | Attribute for the root element of the generated XML. | N/A | String |
Preserve Original | If activated, the option preserves the original fields. | True | Boolean |
Header | XML header to be included before the XML payload. | <?xml version='1.0' encoding='UTF-8' standalone='no' ?> | String |
Messages flow
Input
The component waits for a message in any format, but will look for a path inside the JSON Field Path configuration property.
These are some valid input examples:
Example 1
Example 2
Output
The structure will be equivalent to the one in the input, but with another model and another template representation as string. In case of error, the "error" property will be created at the same level as the original property.
The JSON dotted notation will look for the root element that is being processed by the pipeline and cross it according to the specifications given in the JSON Field Path property.
Example
In a JSON Field Path representation containing a.b.c.d, "a" will be searched in the root element. Afterwards, it will be "b", then "c" and finally "d". If an array is found during the cross, then the algorithm will generate a cross path for each element of the array. The algorithm replaces all the occurrences of the defined path in JSON Field Path.
Without error
_body: if the option Preserve Original is enabled, the property will be shown in the output containing the input JSON.
ZYX: dynamic name based on the JSON Field Path configuration in the component properties.
With error
_body: if the option Preserve Original is enabled, the property will be shown in the output containing the input JSON.
_error: description of the error occurred in the deployment.
XYZ: dynamic name based on the JSON Field Path configuration in the component properties.
JSON to XML Transformer in action
Example 1
JSON Field Path: orders
Root Element Name: doc
Preserve Original: enabled
Header: <?xml version='1.0' encoding='UTF-8' standalone='no' ?>
Input
Output
Example 2
JSON Field Path: payload
Root Element Name: xyz
Preserve Original: disabled
Input
Output
Last updated