Skip to main content Link Search Menu Expand Document Toggle dark mode Copy Code (external link)
paperwork.help

. : Property Access

Reads a property of a value, and can be chained to walk down through nested objects.


On this page

Syntax

{{value.property}}
{{value.property.property}}

Examples

Data:

builder.WithData("model", new {
    customer = new {
        name = "Acme",
        address = new { city = "Leeds" }
    }
});

Template:

<p>{{model.customer.name}}</p>
<p>{{model.customer.address.city}}</p>

Output:

Acme
Leeds

Notes

  • Works with C# objects, dictionaries, and JSON data (WithData with a JSON string or file).
  • Property names are case sensitive, and must match the data exactly.
  • If any part of the path is missing or null, the result is null and nothing is output - there is no error. Use ?? for a default.
  • A leading . refers to the current item - see this.
  • Combine with an indexer to read an item in a collection: {{model.items[0].name}}.

See Also