Render a Mustache or Liquid Template with JSON Online
Render Mustache or Liquid templates with JSON data: loops, conditions, partials, Vietnamese filters (VND, amount in words, dd/mm/yyyy) and mail-merge rows.
Result
Press “Run” to see the result.
Send a template and data and get the rendered text. Two engines run as interpreters (no code generation, safe on a serverless runtime): Mustache (logic-less, {{name}}, {{#items}}…{{/items}}, {{^empty}}, partials {{> header}}) and Liquid (LiquidJS: {% if %}, {% for %}, {% assign %}, {% render "part" %}, 40+ standard filters). engine=auto picks Liquid when the template uses {% %} tags or | filters.
Vietnamese filters work in both engines: vnd (1.500.000 đ), number_vi, vnd_words / so_thanh_chu (Một triệu năm trăm nghìn đồng), date_vn / ngay_vn (20/11/2026), date_vn_long / ngay_thang_nam (ngày 20 tháng 11 năm 2026), remove_accents / bo_dau, upcase_vi, slug_vi. In Liquid they are filters ({{ tong | vnd }}); in Mustache they are sections ({{#vnd}}{{tong}}{{/vnd}}).
output=html escapes values for HTML; the default text does not. rows renders the template once per object (up to 1,000, for SMS / Zalo / e-mail mail-merge). partials holds named templates for includes — no files or URLs are ever read. action=variables lists the variables a template uses. Limits: 200,000-character templates, 2 MB output, about 2 seconds of rendering; data is read through own properties only.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/template-render" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"engine":"liquid","template":"Kính gửi {{ khach.ten }},\nĐơn {{ don.ma }} gồm {% for sp in don.items %}{{ sp.ten }} x{{ sp.sl }}{% unless forloop.last %}, {% endunless %}{% endfor %}.\nTổng: {{ don.tong | vnd }} ({{ don.tong | so_thanh_chu }}), hạn thanh toán {{ don.han | ngay_vn }}.","data":{"khach":{"ten":"Anh Minh"},"don":{"ma":"DH-1024","items":[{"ten":"Áo thun","sl":2},{"ten":"Mũ","sl":1}],"tong":450000,"han":"2026-11-20"}}}'const res = await fetch('https://apibox.io.vn/v1/template-render', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"engine": "liquid",
"template": "Kính gửi {{ khach.ten }},\nĐơn {{ don.ma }} gồm {% for sp in don.items %}{{ sp.ten }} x{{ sp.sl }}{% unless forloop.last %}, {% endunless %}{% endfor %}.\nTổng: {{ don.tong | vnd }} ({{ don.tong | so_thanh_chu }}), hạn thanh toán {{ don.han | ngay_vn }}.",
"data": {
"khach": {
"ten": "Anh Minh"
},
"don": {
"ma": "DH-1024",
"items": [
{
"ten": "Áo thun",
"sl": 2
},
{
"ten": "Mũ",
"sl": 1
}
],
"tong": 450000,
"han": "2026-11-20"
}
}
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/template-render",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"engine": "liquid", "template": "Kính gửi {{ khach.ten }},\nĐơn {{ don.ma }} gồm {% for sp in don.items %}{{ sp.ten }} x{{ sp.sl }}{% unless forloop.last %}, {% endunless %}{% endfor %}.\nTổng: {{ don.tong | vnd }} ({{ don.tong | so_thanh_chu }}), hạn thanh toán {{ don.han | ngay_vn }}.", "data": {"khach": {"ten": "Anh Minh"}, "don": {"ma": "DH-1024", "items": [{"ten": "Áo thun", "sl": 2}, {"ten": "Mũ", "sl": 1}], "tong": 450000, "han": "2026-11-20"}}},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/template-render');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"engine":"liquid","template":"Kính gửi {{ khach.ten }},\\nĐơn {{ don.ma }} gồm {% for sp in don.items %}{{ sp.ten }} x{{ sp.sl }}{% unless forloop.last %}, {% endunless %}{% endfor %}.\\nTổng: {{ don.tong | vnd }} ({{ don.tong | so_thanh_chu }}), hạn thanh toán {{ don.han | ngay_vn }}.","data":{"khach":{"ten":"Anh Minh"},"don":{"ma":"DH-1024","items":[{"ten":"Áo thun","sl":2},{"ten":"Mũ","sl":1}],"tong":450000,"han":"2026-11-20"}}}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Mustache or Liquid?
Mustache is simpler and logic-less; Liquid adds if / for / assign and filters. Use engine=auto to let the API choose from the syntax.
Is Handlebars supported?
Handlebars templates that only use Mustache syntax render with engine=mustache. Handlebars helpers are not supported because the Handlebars compiler generates code at run time.
What happens with an unknown variable?
It renders as empty. With engine=liquid and strict=true an undefined variable returns a missing_variable error instead.