Package name : Converter
Iflow name : Convert JSON to XML
Sender http path: /convert_json_to_xml
-------------------
Convert JSON to XML
-------------------
Source payload:
{
"row": [
{
"CustomerID": "ALFKI",
"Country": "Germany"
},
{
"CustomerID": "BLAUS",
"Country": "Germany"
}
]
}
Target payload:
ALFKI
Germany
BLAUS
Germany
-----------------------------------------
Convert JSON to XML with namespace prefix
-----------------------------------------
Source payload:
{
"row": [
{
"CustomerID": "ALFKI",
"Country": "Germany"
},
{
"CustomerID": "BLAUS",
"Country": "Germany"
}
]
}
xmlns:ns0=urn:practical-sap-ci:learn;xmlns:ns1=http://sap.com/xi/XI/SplitAndMerge
Target payload:
ALFKI
Germany
BLAUS
Germany
-------------------------
Convert JSON array to XML
-------------------------
Source payload:
[
{
"CustomerID": "ALFKI",
"Country": "Germany"
},
{
"CustomerID": "BLAUS",
"Country": "Germany"
}
]
--------------------------------------------------
Convert JSON to XML without "Add XML Root Element"
--------------------------------------------------
Source payload:
{
"nsX:MT_Customer": {
"row": [
{
"CustomerID": "ALFKI",
"Country": "Germany"
},
{
"CustomerID": "BLAUS",
"Country": "Germany"
}
]
}
}
Target payload:
ALFKI
Germany
BLAUS
Germany
-----------------------------------------------------------------------------------
Convert JSON to XML without "Add XML Root Element" and with "Use Namespace Mapping"
-----------------------------------------------------------------------------------
Source payload:
{
"nsX:MT_Customer": {
"row": [
{
"CustomerID": "ALFKI",
"Country": "Germany"
},
{
"CustomerID": "BLAUS",
"Country": "Germany"
}
]
}
}
Target payload:
ALFKI
Germany
BLAUS
Germany
---------------------------------------------------
Convert JSON to XML with empty value and null value
---------------------------------------------------
Source payload:
{
"row": [
{
"CustomerID": "ALFKI",
"Country": ""
},
{
"CustomerID": "BLAUS",
"Country": null
}
]
}
Target payload:
ALFKI
BLAUS
-----------------------------------------------------------------------
Convert JSON with root JSON object contains more than one member to XML
-----------------------------------------------------------------------
Source payload:
{
"status": "success",
"count": 2
}
----------------------------------------------------------------------------------------
Convert JSON with name start with number, contains space, <, >, & and chars not accepted
----------------------------------------------------------------------------------------
Source payload:
{
"status": "success",
"count": 2,
"1st_option": "this",
"last name": "Peter",
"test<>&x#$%^*()": "test chars"
}
https://help.sap.com/docs/integration-suite/sap-integration-suite/limitations-for-json-to-xml-conversion
-----------------------------------
Convert JSON to XML with attributes
-----------------------------------
Source payload:
{
"row": [
{
"@rating": "A",
"CustomerID": "ALFKI",
"Country": "Germany"
},
{
"@rating": "B",
"CustomerID": {
"@attr1": "111",
"@attr2": "222",
"$": "BLAUS"
},
"Country": "Germany"
}
]
}
Target payload:
ALFKI
Germany
BLAUS
Germany