Contents

Popular
 Contents

This policy allows a user to convert the request/response from the XML format to the JSON format.

The usage of JSON format has been increasing for serializing and transmitting structured data over a network connection such as data transmission between a server and a web application. Since JSON format is not widely adopted by all organizations, and as most of the data exchange is done through XML in earlier networks which have not deployed JSON, conversion from JSON to XML or vice-versa has become essential for data interoperability. The policy serves the need to convert data from the XML format to the JSON format.

Configuration

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


Figure 1: XML to JSON Policy Configuration attributes

PropertyDescription
Skip NameSpaces

Whether or not to skip adding namespace declarations to XML elements while converting.

Remove NameSpace Prefix from ElementsWhether or not the namespace prefix from XML elements should be removed when reading for XMLSerializer.
Skip root element

Whether to skip Root Element while converting from XML to JSON. Determines whether the resulting JSON will start off with a top-most element whose name matches the XML root element.

Example

Icon

Consider the XML string below:

If the property is

  • enabled, the string is translated as:

  • disabled, the string is translated as:

Indent Factor

String Indent value for JSON Object.

Example

Sample Input

Output

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

Skip Namespaces property set to 'false' and Indent Factor property set to '4'
Skip Namespaces property set to 'true' and Indent Factor property set to '4'
Skip Namespaces set to 'true' and Remove Namespace Prefix From Elements propety set to 'false'
Adaptavist ThemeBuilder EngineAtlassian Confluence