Jsonify.md - hugo - [fork] hugo port for 9front
(HTM) git clone https://git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
Jsonify.md (1226B)
---
1 ---
2 title: encoding.Jsonify
3 description: Encodes the given object to JSON.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: [jsonify]
9 returnType: template.HTML
10 signatures: ['encoding.Jsonify [OPTIONS] INPUT']
11 aliases: [/functions/jsonify]
12 ---
13
14 To customize the printing of the JSON, pass an options map as the first
15 argument. Supported options are "prefix" and "indent". Each JSON element in
16 the output will begin on a new line beginning with *prefix* followed by one or
17 more copies of *indent* according to the indentation nesting.
18
19 ```go-html-template
20 {{ dict "title" .Title "content" .Plain | jsonify }}
21 {{ dict "title" .Title "content" .Plain | jsonify (dict "indent" " ") }}
22 {{ dict "title" .Title "content" .Plain | jsonify (dict "prefix" " " "indent" " ") }}
23 ```
24
25 ## Options
26
27 indent
28 : (`string`) Indentation to use. Default is "".
29
30 prefix
31 : (`string`) Indentation prefix. Default is "".
32
33 noHTMLEscape
34 : (`bool`) Whether to disable escaping of problematic HTML characters inside JSON quoted strings. The default behavior is to escape `&`, `<`, and `>` to `\u0026`, `\u003c`, and `\u003e` to avoid certain safety problems that can arise when embedding JSON in HTML. Default is `false`.