Data & variables
Renderly injects the data object into the document through variables. This page covers every syntax form — escaped, raw, with fallback and by nested path — plus how tables, QR codes and charts are driven by your data.
Anatomy of a variable
A variable is a {{...}} marker inside the content. At render time, Renderly looks up the given path inside the request’s data object and replaces it with the value found.
| Syntax | Behavior | When to use |
|---|---|---|
{{x}} | Inserts the value with HTML escaping (characters like < > & become entities). | The default and the safe one. Use for any user-supplied data. |
{{{x}}} | Inserts the value raw, without escaping — the HTML is interpreted. | Only for HTML you trust (e.g. a snippet generated by your own system). |
{{x|fallback}} | Uses the text after the bar when the value is missing, null or empty. | Optional fields; avoids gaps in the document. |
{{a.b.c}} | Walks nested paths in data using dots. | Data structured into objects. |
Escaped vs. raw
The difference between {{x}} and {{{x}}} is about safety. The escaped one neutralizes HTML — if the value is <b>oi</b>, it appears literally as text. The raw one injects the HTML to be rendered. Use raw only with trusted content; with third-party data, escaping prevents markup injection.
{{{x}}} does not sanitize anything. If the value comes from an end user, prefer {{x}}. Reserve raw for fragments your own system generates.Fallback — {{x|default value}}
When a piece of data can be missing, the fallback keeps the document from having an empty gap. The text after the bar | is used if the path does not resolve.
| Variable | data | Output |
|---|---|---|
{{status|pending}} | { "status": "paid" } | paid |
{{status|pending}} | {} | pending |
{{notes|—}} | { "notes": "" } | — |
Nested paths
Reach deep objects with dots. Given this data:
{
"data": {
"company": {
"name": "Acme",
"address": { "city": "San Francisco", "state": "CA" }
}
}
}you reference {{company.name}} → Acme and {{company.address.city}} → São Paulo.
All together in the HTML path
In raw HTML, all three scalar forms work. An example combining fallback, nested and raw:
{
"html": "<h1>{{title|Document}}</h1>\n<p>Customer: {{client.name}}</p>\n<div>{{{signature_html}}}</div>",
"data": {
"title": "Receipt",
"client": { "name": "Acme Ltda" },
"signature_html": "<img src='https://example.com/signature.png' />"
}
}html path, substitution is scalar — {{x}}, {{{x}}} and {{x|fallback}}. Tables that iterate over arrays, QR and charts are features of the template path, where the document is structured.Tables — iterating over an array
In the template, a table points to an array in data through a source field (the dataField). Renderly iterates that array and generates one row per item, mapping each column to a key of the item.
{
"template": "invoice",
"data": {
"client": "Acme Ltda",
"items": [
{ "description": "Pro Plan", "qty": 1, "amount": "$99.00" },
{ "description": "Extra user", "qty": 3, "amount": "$135.00" },
{ "description": "Support", "qty": 1, "amount": "$0.00" }
],
"total": "$234.00"
}
}Here the table’s dataField is items. Each object in the array becomes a row; the columns reference description, qty and amount. Scalar fields like client and total are used normally outside the table.
| Concept | What it is |
|---|---|
dataField | The data key that holds the array of rows. |
| row | An item of the array. Repeated automatically for each element. |
| column | Maps a key of the item (e.g. valor) to a cell. |
QR codes
A QR block in the template generates the code from a value in data — typically a URL. It is exactly the mechanism behind the verification mark embedded in every output, but you can also add your own QRs (tickets, links, PIX).
{
"template": "ticket",
"data": {
"event": "Winter Concert",
"holder": "Maria Silva",
"qr": "https://acme.com/ticket/8f2a-1c9d"
}
}Charts
Charts in the template consume a data series from data — usually an array of label/value pairs — and are drawn into the document. Good for reports, printed dashboards and summaries.
{
"template": "monthly-report",
"data": {
"month": "May/2026",
"sales": [
{ "label": "Week 1", "value": 1200 },
{ "label": "Week 2", "value": 1850 },
{ "label": "Week 3", "value": 1600 },
{ "label": "Week 4", "value": 2300 }
]
}
}Best practices with data
| Practice | Why |
|---|---|
| Format numbers and currencies on your side | Renderly inserts the value as it came; “R$ 99.00” is more predictable than 99. |
| Use a fallback on every optional field | Documents stay intact even with partial data. |
| Escape by default, raw only when you trust it | Prevents HTML injection from third-party data. |
| Keep the data shape stable | Tables and charts depend on the keys the template expects. |
Renderly