Download this app from Microsoft Store for Windows 10, Windows 10 Mobile, Windows Phone 8.1, Windows Phone 8, Windows 10 Team (Surface Hub), HoloLens. See screenshots, read the latest customer reviews, and compare ratings for Text Reader.
-->
You can perform basic JSON transformations in your logic apps withnative data operation actions such as Compose or Parse JSON.To perform advanced JSON transformations, you can create templatesor maps with Liquid, which isan open-source template language for flexible web apps. A Liquid templatedefines how to transform JSON output and supports more complex JSONtransformations, such as iterations, control flows, variables, and so on.
Before you can perform a Liquid transformation in your logic app,you must first define the JSON to JSON mapping with a Liquid templateand store that map in your integration account. This article showsyou how to create and use this Liquid template or map.
Prerequisites
- An Azure subscription. If you don't have a subscription, you canstart with a free Azure account.Or, sign up for a Pay-As-You-Go subscription.
- Basic knowledge about how to create logic apps
- A basic integration account
- Basic knowledge about Liquid template language.
Create Liquid template or map for your integration account
- For this example, create the sample Liquid template describedin this step. In your Liquid template, you can useLiquid filters,which use DotLiquid and C# naming conventions.NoteMake sure the filter names use sentence casing in your template.Otherwise, the filters won't work.
- Sign in to the Azure portal.On the main Azure menu, select All resources.In the search box, find and select your integration account.
- Under Components, select Maps.
- Choose Add and provide these details for your map:
Property Value Description Name JsonToJsonTemplate The name for your map, which is 'JsonToJsonTemplate' in this example Map type liquid The type for your map. For JSON to JSON transformation, you must select liquid. Map 'SimpleJsonToJsonTemplate.liquid' An existing Liquid template or map file to use for transformation, which is 'SimpleJsonToJsonTemplate.liquid' in this example. To find this file, you can use the file picker.
Add the Liquid action for JSON transformation
- In the Azure portal, follow these steps tocreate a blank logic app.
- In the Logic App Designer, add theRequest triggerto your logic app.
- Under the trigger, choose New step.In the search box, enter 'liquid' as your filter,and select this action: Transform JSON to JSON - Liquid
- Click inside the Content box so that the dynamic content list appears,and select the Body token.
- From the Map list, select your Liquid template,which is 'JsonToJsonTemplate' in this example.If the maps list is empty, most likely your logic app is not linked to your integration account.To link your logic app to the integration account that has the Liquid template or map,follow these steps:
- On your logic app menu, select Workflow settings.
- From the Select an Integration account list,select your integration account, and choose Save.
Test your logic app
Post JSON input to your logic app from Postman or a similar tool.The transformed JSON output from your logic app looks like this example:
More Liquid action examples
Liquid is not limited to only JSON transformations. Here are other available transformation actions that use Liquid.
- Transform JSON to textHere is the Liquid template used for this example:Here are sample inputs and outputs:
- Transform XML to JSONHere is the Liquid template used for this example:Here are sample inputs and outputs:
- Transform XML to textHere is the Liquid template used for this example:Here are sample inputs and outputs: