wrap
Wrap wraps the value in a map under the given key.
Wrap wraps the value in a map under the given key.
Input
any
Parameters
| # | Type | Required |
|---|---|---|
| 0 | string | yes |
Returns
map
Examples
Wrap a value for a JSON envelope
Input
name = "Alice"Template
{{ name | wrap:'user' }}Output
{"user": "Alice"}Wrap a list under a top-level key
Input
items = ["mug", "pen", "pad"]Template
{{ items | wrap:'data' }}Output
{"data": ["mug", "pen", "pad"]}How is this guide?