JSON to Liquid Converter
BetaTurn JSON, a JavaScript object, a Python dict, a PHP array or YAML into Shopify Liquid: an assign block plus a rendering template, previewed with LiquidJS. Or convert a Handlebars, Mustache or Knap template into Liquid with every unmapped construct listed. Runs in your browser; nothing is uploaded.
- Free, no sign-up
- REST + MCP
- Updated
- Reviewed by Olgun Ozoktas
Paste data in any of five notations and get a Liquid assign block plus a template that renders it.
The Liquid will appear here..
Preview (LiquidJS)
Rendered by LiquidJS, not Shopify's engine: Shopify objects, sections and money formatting are not simulated, and Shopify-only filters pass their input through unchanged.
Why Convert to Liquid in the Browser?
Data mode reads the pasted text with a tolerant parser: strict JSON first, then a literal that accepts unquoted keys, single quotes, trailing commas, comments, undefined, Python's True, False and None, tuples, PHP's => pairs, array() and NULL, and finally YAML for text that does not open with a bracket. The parsed object is written two ways. The assigns block recreates the data with {% assign %} and {% capture %}: scalars as literals (a string that holds both quote characters or a newline becomes a capture, and one that holds Liquid tags is wrapped in raw), scalar arrays as a string split on the first separator that no item contains, arrays of objects as parallel arrays with a comment naming them, and anything deeper as a JSON string. The template skeleton is the markup a section would use: a paragraph per scalar, a link for URLs, an image for image keys, an if guard for booleans and nulls, a list for scalar arrays and a for loop for arrays of objects, with paths under the root variable when you name one.
Template mode tokenises the source into text, outputs, tags and comments, then rewrites each dialect's constructs. Handlebars and Mustache: #if, #unless and #each become if, unless and for; else and else if become else and elsif; block parameters, this, ./ and ../ resolve to Liquid paths through the same scope rules Handlebars uses; @index, @first and @last become forloop members; #with prefixes the names inside it; partials become render tags with their arguments; helpers with arguments become filters of the same name; Mustache sections become loops. Knap: elseif becomes elsif, colon arguments become comma arguments, loop members become forloop members, the ?? fallback becomes the default filter, dayjs date tokens become strftime, upper, lower, trim, length, unique and kebab become their Liquid names, and every Markdown-only filter is kept as written and reported.
Nothing is dropped silently. Each construct that has no Liquid form, changes meaning, or needs a filter or a snippet to exist is listed under the output with its line. Jinja2, Twig and Nunjucks templates are refused rather than half-converted. The preview runs LiquidJS, a Liquid implementation for JavaScript, not Shopify's engine: it shows structure and logic, while Shopify objects, sections, translations and money formatting are not simulated and Shopify-only filters pass their input through. The same two converters are on the FindUtils API and MCP server as json_to_liquid and template_to_liquid.
How it compares
The Shopify Liquid reference explains the language; it does not write the assign block for a JSON file or rewrite a Handlebars template. A generic JSON to code generator writes classes and interfaces, which Liquid cannot use. Online Liquid playgrounds render a template you already have. This page starts from the data or the template you already have, writes the Liquid, tells you where the translation is lossy, and renders the result, all without leaving the tab.
Liquid Conversion Tips
- Every item in a split array is a string. Read a number back with | plus: 0, and compare strings with strings.
- Nested keys are flattened with underscores: shop.name becomes shop_name in the assigns, and stays shop.name in the template, which reads the data as a theme object.
- Arrays of objects become parallel arrays, one per key. Loop over the first and index the others with forloop.index0.
- Handlebars and Mustache escape output by default and Liquid does not, so the converter adds | escape to plain outputs; turn it off for a template that already escapes or that outputs trusted HTML.
- Liquid has no not inside a compound condition and ignores grouping parentheses. The converter says so where it matters; rewrite those lines with unless or a second if.