Syvizo

JSON to XML



When to use

Use this policy when you want to transform messages from JSON format to XML format



Details

The JSON to XML policy allows for the conversion of messages from the JSON format to XML format. It provides several options to control the conversion process.

This policy is especially beneficial when there is a need to transform messages using XSL (Extensible Stylesheet Language). Once the JSON payload is converted to XML, you can utilize the Apply XSLT policy along with a custom style sheet to perform the desired transformation on the XML data.

By employing the JSON to XML policy followed by the XSL Transform policy, you can effectively convert and manipulate JSON payloads into XML format, enabling powerful transformation capabilities in your API proxy.



Configuration

The configuration fields for the policy are:

[* Indicates a mandatory field]

Name *: Display name of the policy

Description: Description of policy

Enabled: Flag to indicate if the policy is enabled. If this field is not checked, the policy will be ignored at runtime and any fields from its output will contain a default initial value

Continue on Error: Flag to indicate that the flow should continue even if this policy throws an error

Array Item Name: The name of the element to which json array element gets transformed to

Attribute Object Name: The name of the json object of which all the keys will be converted to attributes of its parent object

Attribute Prefix: The object keys with the prefix specified here will be added to resulting XML as attributes

Namespace Object: The elements in this object in json will be converted to namespaces

Namespace Separator: This string will be used as separator between namespace prefix and element name

Default Namespace: Default namespace value

Replace Null With: The value with which nulll values in json object will replaced with

Root Element Name: The name of resulting xml root element

Array Element Name: Name of the element to which the array type will be converted to 

Include Namespaces: Specifies if the namespaces should be included 

Keep Element As Text: Converts a JSON object property into an XML text node with the specified name.

Replace Invalid Char With: Characters that are invalid for XML will be replaced by this



Input fields

source: The json object which should be converted to XML



Output fields

xmlString: Resulting XML string after transformation