Contents

Popular
 Contents

The JSON2XML policy enables developers to convert messages from the JavaScript object notation (JSON) format to the extensible markup language (XML) format. This policy is useful for enabling backend XML services to support RESTful applications that require JSON due to, for example, a lack of an XML parsing capabilities on the client.

The attributes available are shown in the figure and described in the section below.

Configuration

The properties that have to be configured so as to use the policy are described below.


Figure 1: JSON to XML Policy Configuration attributes

PropertyDescription
JSON types as attributes

Whether or not JSON element types should be included as attributes in Output XML.

Expand Array Name to Child ElementsEnabling this will copy the parent JSONArray name to its child elements during JSON to XML conversion.
Root NameThis field is used to set the name of the root for the converted XML. If it is set to null, then this property is ignored.

Element Name

This field is used to set the element name for each object of the array in the converted XML. When an array object in JSON format is converted into XML, each element of the JSON array is split into different XML fields. Each field is assigned an Element Name. If it is set to null, then this property is ignored.

Example

Sample Input

Output

Various outputs depending on changes to the configuration are given below.

Root Name property set as 'Root' and Element Name propety as 'element'
JSON Types as Atrributes property and Expand Array Name to Child Elements property enabled
JSON Types as Atrributes property and Expand Array Name to Child Elements property disabled
JSON Types as Atrributes property disabled and Expand Array Name to Child Elements property enabled


Adaptavist ThemeBuilder EngineAtlassian Confluence