Skip to content

Template To Liquid API

POST https://api.findutils.com/api/tools/template-to-liquid/execute

Convert a Handlebars, Mustache or Knap template into Shopify Liquid. Blocks become if/unless/for, Handlebars scopes (this, ../, #with, block params) are resolved to Liquid paths, @index and loop.* become forloop.*, Knap elseif becomes elsif, Knap colon arguments become comma arguments, dayjs date formats become strftime, the ?? fallback becomes | default, helpers with arguments become filters, partials become render tags, and comments become comment blocks. Handlebars and Mustache HTML-escape outputs by default, so their {{ }} outputs gain | escape unless escape_output is false; Knap writes Markdown and gets none. Every construct with no Liquid form (helpers, @key, not inside a compound condition, Markdown-only Knap filters) is kept as written and listed in warnings with its line, never dropped silently. Jinja2, Twig and Nunjucks templates are refused, not half-converted. Auto detects the dialect. The browser page at /developers/json-to-liquid/ previews the result with LiquidJS.

Request body

application/json
  • template

    string required

    The template text.

  • from

    string optional

    The source dialect. auto (default) detects it from the tags used. One of auto · handlebars · mustache · knap. Default "auto".

  • escape_output

    boolean optional

    Add | escape to plain {{ }} outputs, matching the source engine's default HTML escaping. Default: true for Handlebars and Mustache; false for Knap, which writes Markdown.

Example arguments

Verified
{
  "template": "<h1>{{title}}</h1>{{#each items}}<li>{{name}}</li>{{/each}}"
}