Liquid transform engine for BizTalk
JSON content if becoming more and more the standard format. Unfortunally BizTalk uses XML internaly, forcing BizTalk developers to constantly transform between JSON and XML.
With Biztalk 2020 its now possible to create/add custom transform engines, making it possible to add a liquid transform that makes it possible to transform JSON.
This component uses DotLiquid that enables transform of any format. That is because DotLiquid does not really process JSON or XMl or any other files, it just processes objects. That means before one can use DotLiquid one needs to to serialize JSON or XML to a object. At the moment the component transforms all JSON and XML content to anonymous objects.
Transformation works both on Receive and Send ports and also when mapping in Orchestrations.
When creating JSON output one must use the CDATA tag component in conjunction with the StripCDATA pipelinecomponent as creating JSON output directly is not allowed. Unfortunately it is not allowed to create JSON output inside Orchestrations.
- Add the binary BizTalk.Transforms.LiquidTransform to the BizTalk folder ..\Microsoft BizTalk Server\Transform Components.
- GAC both BizTalk.Transforms.LiquidTransform.dll and DotLiquid.dll.
- Add below XML snippet to the CustomTransform.xml file in the BizTalk folder ..Microsoft BizTalk Server\Developer Tools.
<Transform
DisplayName="Liquid"
TypeAssemblyQualifiedName="BizTalk.Transforms.LiquidTransform.LiquidTransform, BizTalk.Transforms.LiquidTransform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=969e815b781bd674"/>
After you have followed above instructions and restarted Visual studio you should now see the new Liquid transform when opening BizTalk map properties.
You will need to use a dummy schema for JSON messages, but be aware that the messagetype will be used in runtime so give it a meningful namespace and root name.
Use a custom .liquid file and add it to the BizTalk maps Custom XSLT property
You should now be able to test the map and get a valid output. Make sure not to validate JSON input/output.
You can use extensionobjects to add custom Filter,Tags or other objects. Bellow is a sample usage of CDATA tag that generates needed xml envelope for when creating JSON output. It's very important that all objects use the namespace BizTalk.Transforms.LiquidTransform.ILiquidRegister.
All ILiquidRegister objects added to the extensionobjects file can then be used in the liquid map.