HUGO
Menu
GitHub 90265 stars Mastodon

debug.Dump

Returns an object dump as a string.
Syntax
debug.Dump VALUE
Returns
string

Usage

The debug.Dump function returns an object dump as a string. The function encodes the given value to JSON, indents nested elements with two spaces, and sorts map keys. If the value cannot be encoded to JSON, the function returns an error message instead.

Output from this function may change from one release to the next. Use for debugging only.

Examples

<pre>{{ debug.Dump hugo.Data.books }}</pre>

The rendered output:

[
  {
    "author": "Victor Hugo",
    "rating": 4,
    "title": "The Hunchback of Notre Dame"
  },
  {
    "author": "Victor Hugo",
    "rating": 5,
    "title": "Les Misérables"
  }
]