We all have come across scenarios where while Integrating between SAP and third party systems we have to convert from
JSON to XML – So that SAP understands the JSON data being sent by the third party
or from
XML to JSON -so that the third party system that understands(or prefers to Understand) only JSON can consume the XML data being sent by SAP.
You should not do these conversions without knowing the supported JSON Conventions by the third party system and then comparing it with SAP CI standard JSON convention as it would be as ridiculous as generating a XSD out of an XML via same online tool.
SAP CI XML to JSON convertor by default supports Rabbit Fish Convention while most of the platforms accept Badger Fish JSON Convention.
Overview
Let’s understand and educate ourselves of the differences between the various JSON conventions.
There are 4 major JSON conventions
- Badger Fish – Most popular but memory intensive in terms of storage
- Rabbit Fish – Best representation of fields and Attributes
- Ray Fish
- Plain JSON
To understand the difference let’s have a look at some examples
JSON Convention | JSON Representation | XML Data |
Badger Fish |
|
|
Rabbit Fish |
|
|
Ray Fish |
|
|
Plain JSON |
|
|
As you can see Rabbit Fish is the most meaningful and complete representation of attributes and nodes. The only possible way to achieve selective JSON to XML conversion is via XSLT mapping (for formats other than RabbitFish) as SAP CI only supports RabbitFish at the moment I hope that we should get radio buttons in the UI to chose the Convention soon.
PS: I have no idea why all the JSON Conventions end in the word “Fish”.