inspect

v10.13.0

Similar with json, but inspect allows cyclic structure. For the scope below:

const foo = {
    bar: 'BAR'
}
foo.foo = foo
const scope = { foo }

Input

{% foo | inspect %}

Output

{"bar":"BAR","foo":"[Circular]"}

Formatting

An additional space argument can be specified for the indent width.

Input

{{ foo | inspect: 4 }}

Output

{
    "bar": "BAR",
    "foo": "[Circular]"
}