Objects

Object fields let you work with structured, nested data in your templates. An object groups related properties together, allowing you to access nested values using dot notation.

Syntax

Access properties of an object using dot notation inside your template fields.

Template syntax
Client: {{client.first_name}} {{client.last_name}}
Email: {{client.email}}
Phone: {{client.phone}}

Adviser: {{adviser.name}}
AFSL: {{adviser.afsl_number}}

Using the with block

For deeply nested objects or when referencing many properties from the same object, use a {{#with}} block to set the context.

With block syntax
{{#with client}}
  Name: {{first_name}} {{last_name}}
  Email: {{email}}
  Phone: {{phone}}
  Address: {{address.street}}, {{address.suburb}} {{address.state}} {{address.postcode}}
{{/with}}

Deep nesting

Dot notation supports multiple levels of nesting. For example, {{client.address.suburb}} accesses the suburb property on the address object inside the client object.

Example data

Data
{
  "client": {
    "first_name": "John",
    "last_name": "Smith",
    "email": "john.smith@example.com",
    "phone": "0412 345 678",
    "address": {
      "street": "42 Collins Street",
      "suburb": "Melbourne",
      "state": "VIC",
      "postcode": "3000"
    }
  }
}