---
title: "JSON to Liquid Converter"
description: "Turn 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."
url: https://findutils.com/developers/json-to-liquid/
category: developers
---

# JSON to Liquid Converter

Turn 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.

**Use this tool:** [JSON to Liquid Converter](https://findutils.com/developers/json-to-liquid/)

## Programmatic access

- REST id `json-to-liquid`: POST https://api.findutils.com/api/tools/json-to-liquid/execute (reference: https://findutils.com/api/json-to-liquid/)
- MCP tool `json_to_liquid` on https://mcp.findutils.com (reference: https://findutils.com/mcp/json-to-liquid/)

## Why Convert to Liquid in the Browser?

Shopify Liquid has no object or array literals, so data that lives in a JSON file, a JavaScript config or a Python script cannot be pasted into a theme as it is. Every developer who has hard-coded a menu, a feature list or a set of settings into a section has written the same translation by hand: one assign per value, arrays as a string split on a comma, arrays of objects as parallel arrays read with forloop.index0. This page writes that block for you, reads five notations so you paste what you have, and also writes the template that would render the same data once it arrives as a theme object. The second mode does the other common job: a Handlebars, Mustache or Knap template from another system, rewritten as Liquid with every construct that has no Liquid form listed by line. Both modes preview the result with LiquidJS, in your browser; nothing is uploaded.

## Frequently Asked Questions

### What does JSON to Liquid actually produce?

Two things from the same data. The assigns block is Liquid code that recreates the values with {% assign %} and {% capture %}: one variable per scalar, nested keys flattened to snake_case names, scalar arrays as split strings, arrays of objects as parallel arrays. The template skeleton is the markup that would render the same data once it arrives as a theme object: paths such as shop.name, for loops over arrays, if guards for booleans and missing values. Use the first when the data must be hard-coded in a section, the second when the data comes from Shopify.

### Why are arrays written as strings with split?

Because Liquid has no array literal. The only way to build an array inside a template is to split a string, so ["new", "sale"] becomes "new,sale" | split: ",". The converter picks the first separator (comma, semicolon, pipe, tilde, caret) that no item contains and says so when none is free. Every item of such an array is a string; use | plus: 0 to read a number and compare strings with strings.

### How are arrays of objects handled?

As parallel arrays, one per key, which is the pattern Shopify developers use by hand: items_title and items_price for a list of items, each a split string, with a comment naming them. Loop over one and read the others with forloop.index0. A key missing from some objects becomes an empty string in those slots, and a nested value inside such an object becomes a JSON string; both cases are listed in the warnings.

### Which notations does Data mode read?

Strict JSON, a JavaScript object literal with unquoted keys, single quotes, trailing commas, comments and undefined, a Python dict with True, False, None and tuples, a PHP array with => pairs, array() and NULL, and YAML. Auto-detect tries JSON, then the literal forms, then YAML for text that does not open with a bracket; the footer under the input says which one was read. Code such as new Date() is refused with its line and column, because it is not data.

### Which template dialects does Template mode convert?

Handlebars, Mustache and Knap. Jinja2, Twig and Nunjucks templates are recognised and refused with a clear message rather than half-converted. Auto-detect looks at the tags used: Handlebars block syntax and partials, Mustache sections, or Knap's elseif, colon arguments and ?? fallback. Set the dialect by hand when a small template does not carry enough clues.

### Why does the output add | escape to my Handlebars variables?

Handlebars and Mustache HTML-escape {{ }} outputs by default and Liquid does not, so a faithful conversion adds | escape to plain outputs and leaves {{{ }}} and {{& }} outputs bare. Choose Never under Escape outputs for a template that outputs trusted HTML or already escapes, or Always to add it to a Knap template, which writes Markdown and gets none by default.

### What do the warnings mean?

Each warning names a line and a construct that has no Liquid form, changed meaning, or needs something to exist. Typical cases: a helper with arguments that became a filter of the same name, a partial that became a render tag whose snippet must exist, a Mustache section converted as a loop, not inside a compound condition rewritten as == false, @key replaced with an index, a Markdown-only Knap filter kept as written, and Knap's habit of trimming whitespace after a tag. Nothing is dropped without a line in that list.

### Is the preview the same as Shopify?

No. The preview runs LiquidJS, a Liquid implementation for JavaScript that follows the standard Liquid syntax and filters. It renders the structure and logic of the template against the data you give it. Shopify's objects such as product and collection, sections and blocks, translations and money formatting are not simulated, and Shopify-only filters such as money and img_url pass their input through unchanged so the preview does not fail on them. Test the final template in a theme.

### Is my data or template uploaded anywhere?

No. Parsing, conversion and the preview run in your browser; LiquidJS is fetched once as a script and no request carries your text. You can confirm that in the browser's network panel while converting.

### Can I run these conversions from a script or an AI agent?

Yes. Both converters are on the FindUtils API and MCP server. json_to_liquid takes the source text, an optional notation, root and escape_html flag and returns the assigns, the template, the notation read and the warnings. template_to_liquid takes the template text, an optional dialect and escape_output flag and returns the Liquid, the dialect read and the warnings with their lines.

## Related Tools

- [Knap Template Renderer](https://findutils.com/developers/knap-template-renderer/)
- [JSON to TypeScript](https://findutils.com/developers/json-to-typescript/)
- [JSON YAML Converter](https://findutils.com/developers/json-yaml-converter/)
- [JSON to Go Struct](https://findutils.com/developers/json-to-go-struct/)
- [JSON Formatter](https://findutils.com/developers/json-formatter/)
- [JSON to Markdown Table](https://findutils.com/convert/json-to-markdown-table/)
