Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Contributor

Update 4 Sep 2018: Now available in CPI as well.

Update 11 Sep 2015: New parameters escapeInvalidNameStartChar and mangleInvalidNameChar to handle behavior if there are invalid characters for XML element names. Order of fields in XML output now also follows order of fields in JSON input

Update 2 Apr 2015: New parameters allowArrayAtTop and topArrayName to handle JSON Array at top level of JSON content

Update 25 Mar 2015: JSONTransformBeanBean has been refactored to be part of FormatConversionBean. Parameter conversionType replaced with converterClass. Note that some of the screenshots are not updated to reflect the new parameter converterClass


With the increase of mobile and cloud solutions, JSON (JavaScript Object Notation) is becoming popular as a lightweight data-interchange format. The file size of data represented in JSON can be significantly smaller than its corresponding representation in XML. Therefore, more and more web services (especially RESTful services) are using JSON as their data interchange format.

Prior to PI/PO 7.4 SP09, there is no native support for conversion of JSON to XML and vice versa. Even with SP09, JSON conversion is limited as a functionality within the new REST adapter, instead of a generic adapter module that can be used with any adapter.

In this two-part series, I will share about JSONTransformBean, a custom adapter module for handling conversion of JSON to XML and back. This module can be used in PI/PO versions older than PI/PO 7.4 SP09 and/or across different adapter types.

This first part covers JSON to XML conversion, while the second part covers XML to JSON conversion.

Source Code

Refer to following blog on location of source code and/or EAR deployment file.

FormatConversionBean - One Bean to rule them all!

This module is based upon the open source JSON in Java library. In order to successfully compile and build this module, the source code for the library needs to be included. Alternatively, the compiled JAR file for the library is also included in the com.equalize.xpi.util library above.

Usage of Module in Communication Channel

Module Processing Sequence

Number Module Name Type Module Key

<Depending on position of module in chain>

1) Asynchronous scenario,

Normally before the last module in channels

2) Synchronous scenario,

Before last module to convert request payload

After last module to convert response payload
Custom_AF_Modules/FormatConversionBean Local Enterprise Bean <Any Arbitrary Value>

Module Parameter Reference

Below are the parameters for configuration of the module for JSON to XML conversion (converterClass = ''). Certain parameters will automatically inherit the default values if it is not configured.

Parameter Name Allowed values Default value Remarks

PI -

CPI -com.equalize.converter.core.JSON2XMLConverter
Required field. Determines conversion class
documentName Required field. Document name of root element of XML output
documentNamespace Required field. Namespace of root element of XML output
indentFactor Integer values beginning from 1 0 Determines the number of indentation spaces for each level in the XML output
allowArrayAtTop Y, N N Determines if a JSON Array at the top level (input beginning with [) is allowed
topArrayName Name of the top level JSON Array. Required field when allowArrayAtTop = 'Y'
escapeInvalidNameStartChar N

First character of XML element name is validated. Character is escaped if it is not a valid name start character.

Examples: 64bit --> __64bit, $money --> __u0024money
mangleInvalidNameChar N

Second and subsequent characters of XML element name are validated. Characters are mangled using the corresponding unicode number they are not valid name character.

Example: field[a] --> field__u005ba__u005d
messageLog pre, post Saves a log version of the message that is viewable in Message Monitor

  • pre = saves payload before conversion

  • post = saves payload after conversion

Available only in PI
logLocation Name of log version when messageLog is populated. Location defaulted to value in messageLog if logLocation not populated. Available only in PI


Module parameters

Parameter Name Parameter Value
documentName MT_JSON2XML
documentNamespace urn:equalize:com
indentFactor 2




  "glossary": {

    "title": "example glossary",

    "GlossDiv": {

      "title": "S",

      "GlossList": {

        "GlossEntry": {

          "ID": "SGML",

          "SortAs": "SGML",

          "GlossTerm": "Standard Generalized Markup Language",

          "Acronym": "SGML",

          "Abbrev": "ISO 8879:1986",

          "GlossDef": {

            "para": "A meta-markup language, used to create markup languages such as DocBook.",

            "GlossSeeAlso": ["GML", "XML"]


          "GlossSee": "markup"






Screenshots of actual configuration and testing are also shown below.

Module configuration on an SFTP sender channel.

The 'oriJSON' log version shows the original JSON content before conversion.

After conversion, the payload changes to XML format.

The audit log shows the trace of steps being executed by the module.


With JSONTransformBean, we are able to handle now services that provide content in JSON format.

Upcoming will be the second part of this series covering XML to JSON conversion with JSONTransformBean. Watch this space!

Second part is now out at JSONTransformBean Part 2: Converting XML to JSON content

Labels in this area