I work on a project doing integration with Azure Integration Services and Azure Functions. As always in integration projects doing mapping is a key area. I’m used from BizTalk development to be able to test my maps without doing deployment which makes it easy to develop in an iterative manner. While working with Logic Apps I started using Liquid transformations and did not find any tool to help with that. Logic Apps transforms with the DotLiquid library (C# Naming conventions). With that information in hand I created a program to test. I separated it in two a library, LiquidTransformationLib.dll, and a program, LiquidTransform.exe. The library makes it easy to use in automated tests.
Parameters for LiquidTransform.exe:
Parameter | Description | Required |
-t | –template | Full path to the Liquid template to use. | Yes |
-c | –content | Full path to Content file. | Yes |
-d | –destination | Full path to destination file. Will overwrite an existing file | Yes |
-r | –rootelement | Root element to add before render. For Logic Apps you will need to use content | No |
-u | –rubynaming | Use RubyNamingConvention, Logic Apps use C# naming conventions and will be the default. | No |
-? | -h | –help | Show help information | No |
You can download source code from the GiHub repo https://github.com/skastberg/LiquidTransformation
If just want the binaries https://github.com/skastberg/LiquidTransformation/tree/master/Binaries
More information about Liquid Transformation in Logic Apps:
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-enterprise-integration-liquid-transform
Thanks!
This was a magic solution. I began my Liquid-journey for literally 1½ hour ago and came across this post.
THANKS!
This will save me tons of time compared to testing using Logic Apps.
Thanks Samuel Kastberg. This helps a lot in writing unit test cases.
[…] i found this post Test your Liquid transformations without deployment and used that tool to do liquid template testing. It will give you output even though the output is […]
I see exe files are deleted, can someone help me where I can download binaries , thanks much.
Raj, I created a release a while ago, there you find the binaries in the zip file. https://github.com/skastberg/LiquidTransformation/releases
Awesome!
I’m however missing a custom filter that Logic Apps and API Management implements: “JSONArrayFor”.
I’ve not yet found a source or repository for this. When running a template using the tag it will throw an error: “Unhandled Exception: DotLiquid.Exceptions.SyntaxException: Unknown tag ‘JSONArrayFor'”
I am currently myself searching for the source for this custom filter but just wanted you to know.
References:
https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-enterprise-integration-liquid-transform?tabs=consumption#transform-xml-to-json
https://dev.to/leonards/liquid-template-in-logic-app-4217
Yes, I’m aware of that. Think the filter comes from the APIM team, I will reach out again the Logic Apps Team and see if we can solve it.
If you succeed then you will make my whole year complete!
Your application already saves me and my team a lot of headaces.
Hi Samuel, I am facing a strange issue. If I run the command without ”-r content” it runs fine and creates a JSON file but whenever I add ”-r content” as I need to use the liquid on logic apps it makes a file but will empty array nodes likes this ”[]”. Any ideas or suggestions, please?
Hi,
Probably an addressing issue. Here is an example of a file where I use -r content when I test it https://github.com/skastberg/LiquidTransformation/blob/master/Code/Samples/carsff_cs.liquid and here is the data file I use https://github.com/skastberg/LiquidTransformation/blob/master/Code/Samples/cars.json