Examples
These examples show how Docamint merges templates with JSON/XML payloads to produce final DOCX and PDF documents.
Invoice
Invoice Example
A simple invoice template:
Invoice Number: {{invoice.number}}
Invoice Date: {{invoice.date}}
Bill To:
{{customer.name}}
{{customer.address}}
Items:
{{#each invoice.items}}
• {{this.name}} - Qty: {{this.qty}}, Total: {{this.total | currency}}
{{/each}}
Grand Total: {{invoice.total | currency}}
JSON payload:
{
"customer": {
"name": "Acme Corporation",
"address": "123 Market Street, Springfield, IL"
},
"invoice": {
"number": "INV-2026-001",
"date": "2026-07-25",
"items": [
{ "name": "Laptop", "qty": 1, "total": 1299.50 },
{ "name": "Mouse", "qty": 2, "total": 50.00 }
],
"total": 1349.50
}
}
Statement
Monthly Statement Example
Template:
Statement for {{customer.name}}
Period: {{period.start}} → {{period.end}}
Transactions:
{{#each transactions}}
• {{this.date}} - {{this.description}} - {{this.amount | currency}}
{{/each}}
Total: {{summary.total | currency}}
JSON payload:
{
"customer": { "name": "Acme Corporation" },
"period": {
"start": "2026-07-01",
"end": "2026-07-31"
},
"transactions": [
{ "date": "2026-07-05", "description": "Subscription", "amount": 29.99 },
{ "date": "2026-07-12", "description": "Refund", "amount": -10.00 }
],
"summary": { "total": 19.99 }
}
Nested
Nested Data Example
Template:
Company: {{company.name}}
Divisions:
{{#each company.divisions}}
Division: {{this.name}}
Teams:
{{#each this.teams}}
• {{this.name}} - Manager: {{this.manager}}
{{/each}}
{{/each}}
JSON payload:
{
"company": {
"name": "TechCorp",
"divisions": [
{
"name": "Engineering",
"teams": [
{ "name": "Platform", "manager": "Alice" },
{ "name": "API", "manager": "Bob" }
]
},
{
"name": "Sales",
"teams": [
{ "name": "Enterprise", "manager": "Carol" }
]
}
]
}
}
XML
XML Example
Template:
Order: {{order.number}}
Customer: {{customer.name}}
Items:
{{#each order.items}}
• {{this.name}} - {{this.qty}}
{{/each}}
XML payload: