Convert between XML/JSON in Logic Apps workflows with the XML-JSON Converter
To run simple XML/JSON transformations, the built-in Logic Apps expressions json and xml do the job fine. When using custom mapping, selection, or structures, the built-in expressions might be too complex to set up.
Invictus provides a XML/JSON Converter component which converts XML/JSON contents, while running a XSLT transformation beforehand (stored in Azure Blob Storage). Removing the complexity from the Logic App
Available endpoints
/api/XmlToJson: transforms incoming request with XML contents to a response with the JSON result./api/JsonToXml: transforms incoming request with JSON contents to a response with the XML result.
- XML ➡️ JSON
- JSON ➡️ XML
The /api/XmlToJson endpoint transforms a provided BASE 64-encoded XML contents to a BASE 64-encoded JSON result. A XSLT transformation (stored in the Azure Blob Storage container called xmltojsonconfigstore) gets run beforehand to map the request in the right structure. This stored transformation gets referenced in the request.
| Request property | Required | Description |
|---|---|---|
Content | yes | The BASE 64-encoded XML contents. |
ConfigName | yes | The file name of the XSLT transformation, stored in Azure Blob Storage. |
Context | no | The dictionary providing context to the conversion, gets copied 1:1 to the response. |
XPath | no | The XPath expression that selects a specific XML node before the XSLT transformation. |
JPath | no | The JPath expression that selects a specific JSON property after the XSLT transformation. |
Full request JSON body example
// POST /api/XmlToJson
{
"Content": "eyJFbnZlbG9wZSI6IHiU2FsZXNPcmRlckluIjp7ICAgICAgICAg...." ,
"ConfigName":"IDD038-inbound.xsl",
"XPath": "/CustomerAccount/Message",
"JPath": "$.Envelope",
"Context": {
"x-conversationId": "29500405-d7cf-4877-a72b-a3288cff9dc0"
}
}
Full response JSON body example
// 200 OK <- /api/XmlToJson
{
"Content": "ejHixZlwI9HiU2FsxNPcmRluIjp7ICAgICagICa...",
"Context": {
"x-conversationId": "29500405-d7cf-4877-a72b-a3288cff9dc0"
}
}
The /api/JsonToXml endpoint transforms a provided BASE 64-encoded JSON contents to a BASE 64-encoded XML result. A XSLT transformation (stored in the Azure Blob Storage container called xmltojsonconfigstore) gets run beforehand to map the request in the right structure. This stored transformation gets referenced in the request.
| Request property | Required | Description |
|---|---|---|
Content | yes | The BASE 64-encoded JSON contents. |
ConfigName | yes | The file name of the XSLT transformation, stored in Azure Blob Storage. |
Context | no | The dictionary providing context to the conversion, gets copied 1:1 to the response. |
JPath | no | The XPath expression that selects a specific JSON property before the XSLT transformation. |
XPath | no | The JPath expression that selects a specific XML node after the XSLT transformation. |
Full request JSON body example
// POST /api/JsonToXml
{
"Content": "eyJFbnZlbG9wZSI6IHiU2FsZXNPcmRlckluIjp7ICAgICAgICAg...." ,
"ConfigName":"IDD038-inbound.xsl",
"JPath": "$.Envelope",
"XPath": "/CustomerAccount/Message",
"Context": {
"x-conversationId": "29500405-d7cf-4877-a72b-a3288cff9dc0"
}
}
Full response JSON body example
// 200 OK <- /api/JsonToXml
{
"Content": "ejHixZlwI9HiU2FsxNPcmRluIjp7ICAgICagICa...",
"Context": {
"x-conversationId": "29500405-d7cf-4877-a72b-a3288cff9dc0"
}
}
Related Bicep template parameters
| Name | Description | Tags |
|---|---|---|
invictusXmlJsonConverterFunctionLocalContainerImage | The URL that navigates to the Azure Container App image of the XML-JSON Converter component. | comp:xml-json-convertercontainer-apps |
storageAccountNamedefault: invictus${resourcePrefix}store | The name of the shared Azure Storage Account, used by all Framework components. | comp:pubsubcomp:transcocomp:regex-translatorcomp:xsd-validatorcomp:xml-json-convertercomp:time-sequencercomp:sequence-controllerstorage |
xmlJsonConverterFunctionNamedefault: inv-${resourcePrefix}-xmljsonconverter | The name of the Azure Container App deployed for the XML-JSON Converter component. | comp:xml-json-convertercontainer-apps |
xmlJsonConverterScaling | The Azure Container App scaling options of the XML-JSON Converter component. | comp:xml-json-converterscalingcontainer-apps |