2

How do I set up Liquid Templates locally? Suppose, I have this liquid template and I want to run this locally.

{%- assign deviceList = content.devices | Split: ', ' -%}
{
    "fullName": "{{content.firstName | Append: ' ' | Append: content.lastName}}",
    "firstNameUpperCase": "{{content.firstName | Upcase}}",
    "phoneAreaCode": "{{content.phone | Slice: 1, 3}}",
     "devices" : [
       {%- for device in deviceList -%}
         {%- if forloop.Last == true -%}
         "{{device}}"
         {%- else -%}
         "{{device}}",
          {%- endif -%}
       {%- endfor -%}
    ]
}

Is it even possible?

David Jacquel
  • 51,670
  • 6
  • 121
  • 147
SK.
  • 4,174
  • 4
  • 30
  • 48

2 Answers2

1

Logic Apps uses the DotLiquid implementation for working with liquid templates which has a couple of differences from the original implementation, specifically the filter and output casing.

Unfortunately, I couldn't find a tool (like a CLI) which is built around dotliquid but there is one for with the original ruby implementation - liquid-cli - which I was able to use to test liquid templates locally.

To get the CLI to work, you would have to use the ruby casing (snake_case) instead of the C# naming conventions (PascalCase) for it to work and then change it back when using it in logic apps.

PramodValavala
  • 6,026
  • 1
  • 11
  • 30
1

I just started as well and at the beginning I was using https://github.com/skastberg/LiquidTransformation which was ok for basic stuff but had some issues if some filters/tags.

But in the end i just created a logic app to test and a free integration account.

FEST
  • 813
  • 2
  • 14
  • 37
  • What filters/tags did you have issues with? I am looking if I can improve it. Remember to use capitals when using the functions – Joost Luijben Dec 12 '22 at 12:48