Test your Liquid transformations without deployment

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

liquidtransformYou 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

https://blogs.msdn.microsoft.com/logicapps/2017/12/06/introducing-the-liquid-connector-transform-json-to-json-json-to-text-xml-to-json-and-xml-to-text/

 

11 Comments

  1. 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.

    Reply

  2. 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

    Reply

  3. 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?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s