Add JSON utilities back

This commit is contained in:
Mathieu Acthernoene 2016-12-15 12:14:47 +01:00
parent e48d798d89
commit 3b5a2eeafe

View File

@ -2,6 +2,7 @@ package main
import (
"bytes"
"encoding/json"
"log"
"os"
"path/filepath"
@ -20,6 +21,14 @@ var ProtoHelpersFuncMap = template.FuncMap{
}) string {
return i.String()
},
"json": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
"prettyjson": func(v interface{}) string {
a, _ := json.MarshalIndent(v, "", " ")
return string(a)
},
}
type GenericTemplateBasedEncoder struct {