Add JSON utilities back
This commit is contained in:
parent
e48d798d89
commit
3b5a2eeafe
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user