Json

The json helper is used to convert a value to a JSON string; it is useful for debugging page data but can also be used to create JSON documents that can be loaded at runtime using Javascript.

Arguments

Parameters

Example

Pass a parameter of the data to print and optionally the pretty hash parameter:

{{json authors.attributed pretty=true}}

Which renders to:

[
  {
    "alias": "tmpfs",
    "name": "Muji",
    "url": "https://tmpfs.org/"
  }
]

Assuming the statement is at the top scope of a template you can print the entire page data using:

{{json this pretty=true}}

When iterating using the each helper the this keyword will print the current scope:

{{#each authors.all}}
{{json this pretty=true}}
{{/each}}

Back to Helpers