diff options
Diffstat (limited to 'modules/templates')
-rw-r--r-- | modules/templates/helper.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/templates/helper.go b/modules/templates/helper.go index a9fc652ca9..1e5fa01089 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -182,6 +182,13 @@ func NewFuncMap() []template.FuncMap { } return path }, + "Json": func(in interface{}) string { + out, err := json.Marshal(in) + if err != nil { + return "" + } + return string(out) + }, "JsonPrettyPrint": func(in string) string { var out bytes.Buffer err := json.Indent(&out, []byte(in), "", " ") |