I was testing out Shopify liquid template to perform XML to XML/JSON data transformation. Liquid template is one of the templating tool mentioned in Microsoft's website to perform data transformation in Logic App (the other tool being the venerable XSLT).
I've not used XSLT before, but comparing to liquid template, the latter seems more friendly. As such, I embarked on using liquid template for my research.
Below are the 2 observations I found, and the workaround I need to do to fulfill the task on hand.
Syntax differences between liquid and dotliquid (used by Microsoft):
a. Capitalisation of first letter, i.e.
b. Different naming, i.e.
The problem for syntax differences is that there's no error. The script just run successfully, but the filter functions are not executed 🙄.
Unable to differentiate single child node vs. list of child nodes. To give an example, below are 2 valid snippets that can be interpreted differently.
<order> <orderItem> <itemName>Item 1</itemName> </orderItem> </order>
<order> <orderItem> <itemName>Item 1</itemName> </orderItem> <orderItem> <itemName>Item 2</itemName> </orderItem> </order>
The first snippet interprets
orderas an object containing
orderItem. On the other hand, the second snippet interprets
orderas an _array _of `orderItem 😅
Fortunately, Microsoft has JSONArrayFor. Using JSONArrayFor instead of For loop, we're able to force
orderto be treated as an array regardless of the number of
Top comments (0)